gcloud command

gcloud command

ยท

1 min read

We will continue with our more useful commands

  • We will create a image for our disk.

--source-disk is your disk name and --source-disk-zone is your disk zone in my case its us-central1-a

gcloud compute images create my-image-1 --source-disk=my-disk-1 --source-disk-zone=us-central1-a

image.png

image.png

  • We will launch instance template.

In this command I'm creating a instance template in a region by using --region flag also I'm saying create boot disk with using our image with the help of --image flag and finally I'm saying use --machine-type e2-micro you can give your desired machine type.

gcloud compute instance-templates create my-template --region=us-central1 --image=my-image-1 --machine-type=e2-micro

image.png

image.png

  • Let's launch a machine image using gcloud.
gcloud compute machine-images create my-machine-instance-image --source-instance=my-gcloud-instance --source-instance-zone=us-central1-a

image.png

image.png

Let's delete our services one by one.

gcloud compute disks delete my-disk-1 --zone=us-central1-a

image.png

gcloud compute images delete my-image-1

image.png

gcloud compute instance-templates delete my-template

image.png

gcloud compute machine-images delete my-machine-instance-image

image.png

Note:- Make sure to delete the resources if you don't need it anymore or else stop else to save money.

That's it, for now, we will continue further more in next blog.

Hope you liked it. Will see you on the next topic ๐Ÿ˜ƒ

ย