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.
Step 2 :- Click to activate cloud shell on your screen's right.
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.
Step 4 :- you will get sign page and choose your desired account.
Step 5 :- Click on Allow.
Step 6 :- Click on copy and paste it in your cli.
Step 7 :- Click on your project.
Step 8 :- Copy your project ID.
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.
Will do some basic commands after that slowly will go for higher commands.
- To list out your VM instances.
gcloud compute instances list
- To know the regions of compute engine.
gcloud compute regions list
- To know the zones of compute engine.
gcloud compute zones list
- Command to create VM instance.
gcloud compute instances create [your instance name]
Refresh your page to see created instance.
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 ๐