Working with Google Compute Engine

This is supposed to be a concise tutorial and you should not spend longer than 10 minutes to go through it.

What is Google Cloud Platform (GCP)?

Google Cloud Platform (GCP) is a suit of cloud computing services that run on the same infrastructure as Google uses internally. GCP provides:

Those who are familiar with other cloud service provider (such as AWS, Azure) can view this comparison between GCP and the others for the better understanding. For example, AWS EC2 is like Google Compute Engine, AWS Elastic Beanstalk is like Google App Engine, etc..

In the following of this tutorial, we will briefly explain what you should know about Google Compute Engine.

What is Compute Engine?

Compute Engine offers to use virtual machines running in Google infrastructure. Pricing for Compute Engine is based on per-second usage. For the detailed price sheet, visit this page on Google Cloud document.

To begin using Compute Engine, we need to create a project on GCP first. This can be done via either using GCP web console (cf. this tutorial) or its cloud SDK. The above figure illustrates an interface of the web console. Once a project is created, we can proceed to create a VM instance. The right-hand side figure illustrates a web interface of Compute Engine. The detail of creating and starting a VM instance can be found here. Indeed, such steps are very easy and the instructions provided by the web interface are very helpful.

Connecting to Linux instances

There are 2 methods for connecting to Linux instances: (1) we can use the GCP console (via the web interface) and (2) we can use command line tools in the SDK. In the following, we merely provide succinct steps to connect Linux instances via the gcloud commands in SDK. Note that the detailed steps and guidelines of using the GCP console can be found at the official documentation.

  1. Set the current project using gcloud config set project my-project
    • To see all GCP projects, use: gcloud projects list
    • If you don't want to set the current project, use select project flag as follows: gcloud --project my_project compute ssh my_vm
  2. Use gcloud ssh command to connect instances: gcloud compute ssh --project [PROJECT_ID] --zone [ZONE] [INSTANCE_NAME]

Once the connection is established, use the terminal to run commands on your Linux instances. When you finish, disconnect from the instance by using the exit command.

Other blogged posts >> Tutorials