Practice Exams:

Google Associate Cloud Engineer – Block and File Storage in Google Cloud Platform – GCP part 3

  1. Step 10 – Playing with Disks – Gcloud

Welcome back. Instead, let’s look at how we can play with disks from the command line. It’s the same thing that we used when we played with Compute instances gcloud Compute however, instead of instances we have disks. So Gcloud Compute list create Delete resize Snapshot let’s start with doing a simple Gcloud Compute Instances list and before I would be able to do that, let’s launch up Cloud Shell. I’ll open up Cloud Shell in a new window and let’s set the Project ID g Cloud Config Set Project and you can pick up the Project ID of the Myfuss project which is present in here. It’s going further 304608 so let’s set that in. Let’s authorize so Core Slash project is being updated and we are all set and I would want to list the disks.

Gcloud Compute Disks List I have just one disk that is present right now. Instance one, you can see that it’s in US central one, a size of it is ten and you can see the type PD balanced and the status is ready. And we can also create disks. You can say I want to create a disk in this specific zone by using the Create command. When you are creating a disk, you can also specify the size and the type. You can specify size by using Hyphen iPhone size is equal to specific size, so you can say one GB or two Terabytes. For example. You can also specify the type by using Hyphen. Hyphen type is equal to type. The default is PD standard.

So if you are creating a disk now, you’d see that it would be created with the default PD standard. If you want to see the list of dispens which are supported, you can type in this command as well. So Gcloud Compute disk Types List this would list the different types of dis types that are supported in different regions. Let’s pick up one of these regions. You can see that this specific region Asia South east. Two B supports all the four local SSD. PD balanced PD, SSD and PD standard. You can use any of those values to create a disk in Asia Southeast Two B. Typically you would see that almost all zones support all the four options. The next important thing when we are creating a disk is what should be on the disk.

The size is important, type is important, but what data should be on the disk is also important. And to specify what data should be on the disk, you can either use an image, you can create a disk from an existing image or you can create it from the latest image in a specific image family. So in a specific image family there might be 100 images from that, whichever is the latest one. I would want to use that to create a disk. In that kind of situation I can specify MH family. You can also create a disk from another disk in that kind of situation, you can use a Hyphen hyphen source disk. You can also create a disk from a snapshot. In that kind of situation, you can use Hyphen hyphen source snapshot. The next important thing when we are creating a disk is how should data on the disk be encrypted? You can specify the Kms key and the Kms project.

If you are using the key from a different project, you can also specify the Kms project.  So when we are creating a disk, the important options are size, type, where should the disk be created from and how should the data on the disk be encrypted.The next thing that you can do with a disk is to resize it, change the size I would want to increase from 1 would want to go from ten GB to 100 GB. In those kind of situations, I can use the resize command gcloud compute disks resize and resize the disk and specify the size. So let’s do a clear gcloud compute disks list not lit I would want list okay, there’s the disk and I would want to increase the size g cloud Compute. While the disk is attached to the VM, we can increase its size.

Compute disks resize which one do you want to resize? This is the one which you would want to resize. Instance one this is having the same name as the VM it is attached with. And I can specify the size. Hyphen size is equal to let’s say right now the size is ten GB. Let’s say I would want to make it 20 GB. Let’s press enter. What does it ask for? As usual, it asks us for the region or the zone. You can see that this is specific. This one is created in Zone. So let’s add in a zone option. So I’ll say Hyphen hyphen zone is equal. To put that in here, I can also do a set zone. I’ll just do it this way. And when I press Enter right now, it says this command increases this size. This change is not reversible. One important thing to remember is the disk size can only be increased.

You cannot decrease them. That’s the reason why it’s saying this change is not reversible. And you can go in here and see the information about it. I would want to continue so that’s yes, you’d see that the disk resize would be very, very quick and it would come back. It says the disk is now resize. And if you do a Gcloud compute disk list, you’d see that the size of the disk NAV is 20 GB. So you can create disks, you can resize them. Only increasing size is supported. Gcloud compute disks snapshot so if you want to take a snapshot of the disk, you can also do that from the command line. All that you need to do is snapshot. What is the name of the disk, which zone your disk is in? And you can also specify a name for your snapshot.

So taking a snapshot should be very, very easy. Once you have snapshots, you can also play with the snapshots which I created. So gcloud compute snapshots list, for example. Let’s do that. Gcloud compute snapshots list. We already created a snapshot from the console. You can see that present in here. It’s snapshot. One was created from the console earlier, and you can see the size of it. You can see the source disk from where it was created. And what is the status of the snapshot in the step? We started with playing with this from the command line. I’m sure you’re having an interesting time and I’ll see you in the next step.

  1. Step 11 – Playing with Images – Gcloud

Back. Instead, let’s play with images from the command line you want to guess the command to play with images for disk it was G Cloud Compute Disk for instances gcloud Compute instances what is it for images? Yep, your guess is right. It’s g cloud compute images. And the different actions that you can perform are a lot you can do create, delete, deprecate, describe, export, import, list it let’s look at some of these options right now. So you can create images by using Gcloud Compute Images create my image always remember images, instances, disks, it’s not image, it’s not disk, it’s not instance. It’s always a plural in here. So after Gcloud Compute, we’ll have a plural images, disks, instances and so on and so forth. What do you want to do? We want to create an image so my image and where do you want to create the image from? That’s what you need to specify next.

So if you want to create an image from a disk, you can specify a source disk hyphen hyphen source Disk is equal to the name of your disk and you can also specify the zone where your disk is present in source Disk zone is equal to which zone your specific source disk is present from. Or you might want to create an image from a snapshot. In those kind of situations you need to specify the source snapshot if you want to create it from another image. You can also specify the image as Source Image. Source Image is called Source Image and you can also specify the project. Source Image Project is equal to a specific project where the image is present in. So if you want to copy an image from one project to another, you can do that by using the G Cloud Compute Images Create command.

You can also create an image from the latest nondeprecated image in a family. So instead of specifying the specific exact image, you can also specify the family. So you can say this is the family. Whichever is the latest image in that family, use that so that’s creating images. You can create an image from a disk, a snapshot, another image or latest nondeprecated image from a specific family. The next important feature with images is deprecating images. Once you have created an image, once you have made use of it for some time, there might be a new version of that image which is created and the new version might be the one which you would recommend to use to create your virtual machines.

In that kind of situation you can deprecate the old image, you can say this image should not be used anymore and the way you can do that is by saying Gcloud Compute Images deprecate Image Hyphen hyphen state is equal to deprecated. Once you have an image, you can also export the image. The way you can do that is by saying Gcloud Compute Images export name of the image and you can specify where you would want to upload it to. One of the places you can upload it to is cloud storage. Cloud storage is the object storage in Google Cloud, and you can specify which bucket in cloud storage you’d want to export it to. You can also specify the format so you can export the virtual disk image to cloud storage, and you can specify which format you’d want to make use of.

You can also delete the image so G Cloud compute images delete, and you can specify the name of the images. You can also specify multiple image names separated by spaces. In this, we quickly looked at some of the important things that you can do with images from the command line. You can create them, you can delete them, you can duplicate images, you can describe a specific image by specifying a name of the image. You can also export it so you can specify the format, and you can export it. If you have any images which are present on premises, you can also import them. You can do a little, and you can also update an image. I’m sure you’re having a wonderful time, and I’ll see you in the next step.

  1. Step 12 – Scenarios – Persistent Disks

Welcome back. In this quick step, let’s look at a few scenarios related to persistent discs. You want to improve the performance of your persistent disks. Some of the options that you can consider are to increase the size of the persistent disk or add more persistent disks. Or you can increase the number of vCPUs which are attached with your VM. You want to increase durability of your persistent disks. The way you can do that is by going for regional persistent disks. They have two exit cost, but they are replicated in two zones. You want to take hourly backup of persistent disks for disaster recovery.

How can you do that? This should be easy, right? We talked about snapshots earlier, and if you want to do an hourly backup, you cannot do that manually. And that’s why you would go for scheduling, so you can schedule early snapshots. Next one, you want to delete old snapshots created by scheduled snapshots. So you have already a scheduled snapshot which is creating a snapshot, let’s say every day, and you’d want to delete snapshots which are older than five days, for example. How can you do that? The answer is actually you can do that as part of your scheduling itself. As part of your snapshot scheduling. You can also configure you can also configure how long you want to retain your old snapshots for.

Earlier, we were actually let me do a reject in here. Let’s close this. And where did we create the snapshots? Let’s go there. So, storage snapshots. We created a snapshot set schedule, earlier snapshot schedule. And as part of your snapshot schedule, you can say I would want to schedule a snapshot at a specific frequency and can also click and I can also say auto delete snapshots after a specific time period. So this is where we can configure these two options that we are talking about. Once we create a schedule, you can attach it with a persistent disk. In this step, we looked at a few scenarios related to persistent disks. I’ll see you on the next step.

  1. Step 13 – Exploring File Storage with Filestore

Welcome back. In this quick step let’s look at File Store. You don’t really need to know a lot of details about the File Store. All that you need to be aware about it is the fact that it’s a shade cloud file storage. File store supports NFS v three. So whenever you are talking about file share, one of the most popular protocols is NFS and Cloud File Store supports NFS v three. Cloud file store is provisioned capacity. Basically you need to say how large a file store you would want to provision. It is suitable for high performance workloads. So you can provision a file store up to 320 terabytes and you can get throughput of 16 GB per second and operations per second. File Store supports HDD which is general purpose and SDD performance critical workloads.

The typical use cases when you would go for File Store are when you’d want to create a file share media workflows or content management. We already saw how to create a file store. So you’d go to File Store and if the API is not enabled, you need to wait for the API to get enabled. We have already done that, so I would expect to go to File Store directly and this is where we can actually create a file story instance. So these file storage instances can be attached with your Google Compute engines or Kubernetes or instances that are part of your Kubernetes clusters. And this is where you can configure instance ID. You can choose a type whether you want high scaling one or you can go for a basic one. The basic one, as it says in here is general purpose and it is optimized for cost.

However, if you want higher performance, you can go for high scale performance scales with capacity. This is where you can also configure the storage type. You can either use a HDD or a SSD. SSD is recommended for performance critical workloads and you can allocate capacity. So you can say I would want ten terabytes or whatever amount of terabytes bytes that you’d want. You can choose where you’d want to store the data and once you do that you can give it a name and create it and attach it with your VMs whenever you want a file share. The service in GCP is file store. I’m sure you’re having an interesting time and I’ll see you in the next step.

  1. Step 14 – Exploring Global, Regional and Zonal Resources

Welcome back. In the last few steps, we actually discussed about a number of resources and we talked about some of them are global resources, regional resources and Zonal resources. Let’s quickly review some of them. So what are the global resources? Whenever we create an image, by default it’s global. Whenever we create a snapshot, we can also create global snapshots. Multiregional snapshots. Instance templates that we create are also global. Unless we are making use of any Zonal resources in our instance templates, they are also global. Now, what are the regional ones? The regional ones are managed instance groups.

Whenever we are creating a regional managed instance group, it’s at a regional level. We can also create regional persistent disks. These are replicated across two zones in a single region. The last one are zonal. You can create Zonal managed instance groups.I can say I would want instances for this managed instance group to be created only in this specific zone. Every instance that we create a VM instance that we create is created in a single zone. So all VM instances that we created are created in a specific zone. However, an instance group which is managing the instances can be creating instances in multiple zones.

So instances in single zone. However, I can have multiple instances in multiple zones. Similar to that, a persistent disk that we create is also located in a specific zone. One important thing to remember is whenever we create a persistent disk in a specific zone, you can only attach it to instances in the same zone as the disk. If you want to attach it with instances in a different zone, what do you need to do? You need to copy disk to a different zone and then you can actually attach it with an instance in that specific zone. I’m sure you’re having interesting time and I’ll see you in the next step.

  1. Step 15 – Scenarios – Block and File Storage

Welcome back. Next up, let’s look at different scenarios related to storage. Let’s focus on block and file storage for NAV you want high I ops very high I ops but your data can be lost without a problem. So you have ephemeral data and you want very high IOPS. What would you do? You’d go for local SSDs. You want to create a high performance file sharing system in GCP, which can be attached with multiple VMs. So file sharing system, file store you want to back up your VM configuration along with its attached persistent disk you would create a machine image. If you just want a backup of your VM configuration you can go for instance, template if you’d want backup of just the root persistent disk, you can create an image.

If you’d want to take a backup of a specific persistent disk, you can actually create a snapshot as well. However, if you want to back up everything, the VM configuration and all of its multiple persistent disk, you can go for a machine image you want to make it easy to launch VMs with high end OS and customized software. What would you do? You can actually create a custom image so you can create a custom image with all the patches installed, which with all the software installed and you can launch VMs from that specific image. I’m sure you had a wonderful time in this section and I’ll see you on the next step.