The Google Cloud Platform is one of the three major cloud platforms (the others are Amazon Web Services and Microsoft Azure). Thanks to their generous, we have some credits to use as part of our computing resources this semester. In this document, we are going to walk through some of the basics of working with GCP.


Let’s start with a little GCP vocabulary:

  • user: This is you, as identified by your Google account.
  • billing account: This is a source of funds for using Google cloud platform resources. In particular, you will set up a billing account associated with your course credit courtesy of the Google education program.
  • project: A project is where we actually keep track of resources in GCP. A project is associated with a billing account that is used to pay for any resources.
  • Compute Engine: The name of Google’s “infrastructure as a service” offering. Lets us create virtual machines where we can develop and run our codes.
  • Cloud Shell: A free GCP service that gives us a (short-lived) virtual machine and 5 GB of persistent storage. Recommended for lightweight development tasks.

Starting at the console

The starting point for our exploration is the Cloud Console. From the console, you can select a current project or create a new project. You will need a project in order to be able to use any of the compute engine resources.

In the top menu of the screen, just to the right of the search bar, is the icon for the Google Cloud Shell. If you click on that, Google will start a session for you on a small, short-lived virtual machine (an e2-small instance in Google terminology) with 5 GB of persistent storage for a home directory. Alternately, you can access the cloud shell with the gcloud command line tool, which you can install on your local machine. If you’re iffy on how to get around in Unix, I recommend the software carpentry lessons and the MIT missing semester course. There is also a good Linux introduction from CAC.

The Cloud Shell machine is a full-blown Debian install, with a variety of development tools. For messing around and “hello world” types of programs, I highly recommend using this as a starting development environment. If you want to build anything big, or do some timing runs, you should use Compute Engine to get a Linux VM set up.

Setting up git

You will probably want to set up your cloud shell instance to use git (at least, that’s what I wanted on my system) for cross-machine version control. I recommend you start the process by telling the system who you are. From the cloud shell, type

git config --global ""
git config --global "Your Name"

where the email and name are replaced with your actual email and name.

You may also want to set up password-less access to your Github account, assuming you use Github. I highly recommend getting familiar with at least the basics of git and Github, though if you find that you’re just muddling through and figuring it out as you go, you are in great company. If you use the Google SDK, you can forward your authentication credentials from your home machine; alternately, you can set up a new SSH key on your cloud shell instance:

ssh-keygen -t rsa -b 4096 -C ""
eval "$(ssh-agent -s")
ssh-add ~/.ssh/id_rsa
cat ~/.ssh/

then copy the SSH public key that you printed in the last step to the Github authentication settings page. Once this is set up, you can push and pull to your private repositories at will. You can add this to your bash profile to make sure that the SSH agent is set up whenever you start the cloud shell

if [ -z "$SSH_AUTH_SOCK" ] ; then
  eval `ssh-agent -s`

you can edit .bash_profile with a standard Unix editor like vi, or using the “Open Editor” button at the top of the cloud shell window.

Walk through Linux VM quickstart

Once you have things set up to your liking with the cloud shell, I recommend trying out the Linux VM quickstart guide. This will show you how to create a new Debian Linux VM with a single CPU. This type of virtual machine is quite inexpensive to run, and we will be using it for some of our single-core timing and tuning homework exercises. Make sure to shut the machine down when you are done with it!