Google compute Engine using gcloud CLI

Google compute Engine using gcloud CLI

ยท

2 min read

In this lab we are going to launch compute engine using gcloud cli also some basic gcloud commands

why use gcloud cli ?

gcloud cli (Google Cloud Command Line Interface) Now time is the essence it's good we use GCP UI but launching computing engine using cli will be very easy and fast, within a two three lines of command you can launch GCP services like compute engine, Google storage and other services, etc.

Let's start

Step 1 :- Make sure you are in right project.

image.png

Step 2 :- Click to activate cloud shell on your screen's right.

image.png

Step 3 :- type the following commands:-

gcloud auth login

This command will authorize your gcp account inorder to use your gcp cli.

it will ask you :- Do you want to continue (Y/n)? y

type y to get the link and click on the link to get your authorization code. image.png

Step 4 :- you will get sign page and choose your desired account.

image.png

Step 5 :- Click on Allow.

image.png

Step 6 :- Click on copy and paste it in your cli.

image.png image.png

Step 7 :- Click on your project.

image.png

Step 8 :- Copy your project ID. image.png

Step 9 :- write the following command.

  • This command will set your project.
gcloud config set project [Enter your project ID]

click on Authorize to continue. chrome_JBfhPlAiIz.png image.png

Will do some basic commands after that slowly will go for higher commands.

  • To list out your VM instances.
gcloud compute instances list

image.png

  • To know the regions of compute engine.
gcloud compute regions list

image.png

  • To know the zones of compute engine.
gcloud compute zones list

image.png

  • Command to create VM instance.
gcloud compute instances create [your instance name]

image.png

Refresh your page to see created instance.

image.png

Finally we launched our VM instance using CLI.

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

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

Next Topic

bvakash.hashnode.dev/google-compute-engine-..

ย