Getting Started with Cloud Shell & gcloud

1. Overview

Google Cloud Shell provides you with command-line access to computing resources hosted on Google Cloud Platform and is available now in the Google Cloud Platform Console. Cloud Shell makes it easy for you to manage your Cloud Platform Console projects and resources without having to install the Google Cloud SDK and other tools on your system. With Cloud Shell, the Cloud SDK gcloud command and other utilities you need are always available when you need them.

In this codelab, you will learn how to connect to computing resources hosted on Google Cloud Platform via the web. You will learn how to use Cloud Shell and the Cloud SDK gcloud command.

This tutorial is adapted from and

What you'll learn

  • How to connect to computing resources hosted on Google Cloud Platform
  • How to use gcloud commands

What you'll need

  • Familiarity with standard Linux text editors such as Vim, EMACs or Nano

How will you use this tutorial?

Read it through only Read it and complete the exercises

How would you rate your experience with using Google Cloud Platform services and Firebase?

Novice Intermediate Proficient

2. Setup and Requirements

Self-paced environment setup

  1. Sign in to Cloud Console and create a new project or reuse an existing one. If you don't already have a Gmail or Google Workspace account, you must create one.




Remember the project ID, a unique name across all Google Cloud projects (the name above has already been taken and will not work for you, sorry!). It will be referred to later in this codelab as PROJECT_ID.

  1. Next, you'll need to enable billing in Cloud Console in order to use Google Cloud resources.

Running through this codelab shouldn't cost much, if anything at all. Be sure to to follow any instructions in the "Cleaning up" section which advises you how to shut down resources so you don't incur billing beyond this tutorial. New users of Google Cloud are eligible for the $300 USD Free Trial program.

Launch Cloud Shell

Activate Cloud Shell

  1. From the Cloud Console, click Activate Cloud Shell 4292cbf4971c9786.png.


If you've never started Cloud Shell before, you're presented with an intermediate screen (below the fold) describing what it is. If that's the case, click Continue (and you won't ever see it again). Here's what that one-time screen looks like:


It should only take a few moments to provision and connect to Cloud Shell.


This virtual machine is loaded with all the development tools you need. It offers a persistent 5GB home directory and runs in Google Cloud, greatly enhancing network performance and authentication. Much, if not all, of your work in this codelab can be done with simply a browser or your Chromebook.

Once connected to Cloud Shell, you should see that you are already authenticated and that the project is already set to your project ID.

  1. Run the following command in Cloud Shell to confirm that you are authenticated:
gcloud auth list

Command output

 Credentialed Accounts
*       <my_account>@<>

To set the active account, run:
    $ gcloud config set account `ACCOUNT`
  1. Run the following command in Cloud Shell to confirm that the gcloud command knows about your project:
gcloud config list project

Command output

project = <PROJECT_ID>

If it is not, you can set it with this command:

gcloud config set project <PROJECT_ID>

Command output

Updated property [core/project].

3. Use the command line

After Cloud Shell launches, you can use the command line to invoke the Cloud SDK gcloud command or other tools available on the virtual machine instance. You can also use your $HOME directory in persistent disk storage to store files across projects and between Cloud Shell sessions. Your $HOME directory is private to you and cannot be accessed by other users.

Let's get started by taking a look at the commands available to you. Try this:

gcloud -h

Simple usage guidelines are available by adding -h onto the end of any gcloud invocation. More verbose help can be obtained by appending the --help flag, or executing gcloud help COMMAND.

Give it a try:

gcloud config --help

Now try

gcloud help config

You will notice that gcloud config --help and gcloud help config commands are equivalent—both give long, detailed help.

4. Using gcloud commands

Let's try to view the list of configurations in our environment. From reading the long, detailed help in our previous step, we know we can use the command gcloud list.

gcloud config list

You may wonder whether there are other properties that were not set. You can see all properties by calling:

gcloud config list --all


In this step, you launched Cloud Shell and called some simple gcloud commands.

5. Congratulations!

You learned how to launch Cloud Shell and ran some sample gcloud commands.

Learn More


This work is licensed under a Creative Commons Attribution 2.0 Generic License.