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
This tutorial is adapted from https://cloud.google.com/cloud-shell/docs/quickstart and https://cloud.google.com/sdk/gcloud/
If you see a "request account button" at the top of the main Codelabs window, click it to obtain a temporary account. Otherwise ask one of the staff for a coupon with username/password.
These temporary accounts have existing projects that are set up with billing so that there are no costs associated for you with running this codelab.
Note that all these accounts will be disabled soon after the codelab is over.
Use these credentials to log into the machine or to open a new Google Cloud Console window https://console.cloud.google.com/. Accept the new account Terms of Service and any updates to Terms of Service.
Here's what you should see once logged in:
When presented with this console landing page, please select the only project available. Alternatively, from the console home page, click on "Select a Project" :
From the GCP Console click the Cloud Shell icon on the top right toolbar:
Then click "Start Cloud Shell":
It should only take a few moments to provision and connect to the environment:
This virtual machine is loaded with all the development tools you'll need. It offers a persistent 5GB home directory, and runs on the Google Cloud, greatly enhancing network performance and authentication. Much, if not all, of your work in this lab can be done with simply a browser or your Google Chromebook.
Once connected to the cloud shell, you should see that you are already authenticated and that the project is already set to your PROJECT_ID:
gcloud auth list
Credentialed accounts: - <myaccount>@<mydomain>.com (active)
gcloud config list project
[core] project = <PROJECT_ID>
If it is not, you can set it with this command:
gcloud config set project <PROJECT_ID>
Updated property [core/project].
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:
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
Give it a try:
gcloud config --help
gcloud help config
You will notice that
gcloud config --help and
gcloud help config commands are equivalent—both give long, detailed help.
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 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
You learned how to launch Cloud Shell and ran some sample
This work is licensed under a Creative Commons Attribution 2.0 Generic License.