Google Cloud Platform (GCP), offered by Google, is a suite of cloud computing services that runs on the same infrastructure that Google uses internally for its end-user products, such as Google Search, Gmail, file storage, and YouTube. Alongside a set of management tools, it provides a series of modular cloud services including computing, data storage, data analytics and machine learning. Registration requires a credit card or bank account details.
Google Cloud Platform provides infrastructure as a service, platform as a service, and serverless computing environments.
In this tutorial, we’ll understand how to launch VM instances in Google Cloud platform through “GCP console” and through Command Line using “gcloud Shell”.
- It Is believed that you have already setup your free account for GCP.
Check this link for free sign up: https://cloud.google.com/free
2. Check GCP’s documentation what is free and what not, so that you don’t incur charges at end of the month.
Caution: While launching VM and selecting Machine Type, at the right hand of your screen, It will show you the monthly estimate of the machine. Please check this out before launching the machine.
Create a virtual machine using the GCP Console
- In the Navigation menu , click Compute Engine > VM instances.
- Click Create.
3. On the Create an Instance page, for Name, type
4. For Region and Zone, select the region as us-central1 and Zone as us-central1-a
5. For Machine type, Select e2-Micro.
6. For Boot disk, if the Image shown is not Debian GNU/Linux 9 (stretch), click Change and select Debian GNU/Linux 9 (stretch).
7. Leave the defaults for Identity and API access unmodified.
8. For Firewall, click Allow HTTP traffic.
9. Leave all other defaults unmodified.
10. To create and launch the VM, click Create.
Note: The VM can take about two minutes to launch and be fully available for use.
11. Now click on the SSH Icon next to it. You will see a terminal opens up. Run some commands to validate your settings.
Create a virtual machine using the gcloud command line
Now let’s understand how to create VM’s in GCP through gcloud shell. Please perform next steps:
12. In GCP console, on the top right toolbar, click the Open Cloud Shell button:
13. You will see a window like below. Click Continue.
14. To display a list of all the zones in the region enter this command:
gcloud compute zones list | grep us-central1
15. To set your default zone to another zone ( us-central1-b), enter the below command
gcloud config set compute/zone us-central1-b
16. Now Lets create another VM using command line.
- To create a VM instance called my-vm-2 in that zone, execute this command:
- You will see your new VM has been launched:
That concludes our Tutorial.