Quickstart

This page shows you how to perform basic operations in Google Cloud Shell.

Before you begin

In the Cloud Platform Console, go to the Manage resources page and create a new project.

Go to the Manage resources page

Start Cloud Shell

Click the Activate Google Cloud Shell button at the top of the console window.

Activate Google Cloud Shell

A Cloud Shell session opens inside a new frame at the bottom of the console and displays a command-line prompt. It can take a few seconds for the shell session to be initialized.

Cloud Shell session

Your Cloud Shell session is ready to use.

Use the command line

Run the gcloud version command to try the gcloud command-line tool from within the Cloud Shell session:

gcloud version

This will display a list of installed Cloud SDK components and their versions:

Cloud Shell session

Use your home directory

Try out your home directory:

  1. Change your current working directory:

    cd $HOME
    
  2. Open your .bashrc configuration file using vi.

    vi ./.bashrc
    

    The editor opens and displays the contents of the file.

  3. Press the ESC key and then q! to exit the editor.

The contents of your Cloud Shell home directory persist across projects between all Cloud Shell sessions, even after the virtual machine terminates and is restarted.

Preview and deploy an App Engine application

Use web preview to preview an App Engine app before you deploy it:

  1. Clone a sample app and run it locally in the Cloud Shell session using the App Engine development server.
git clone https://github.com/GoogleCloudPlatform/appengine-guestbook-python \
    && cd appengine-guestbook-python \
    && dev_appserver.py ./app.yaml
  1. Click the Web Preview button Web Preview Button and then select the port number from the displayed menu.

    Cloud Shell opens the preview URL on its proxy service in a new browser window.

  2. When you are done previewing the App Engine app, type Ctrl + C to stop the development server.

  3. Deploy the app to App Engine:

    gcloud app deploy ./index.yaml ./app.yaml
    
  4. Open the application in your web browser. The URL is https://[PROJECT_ID].appspot.com/.

    It may take a few minutes for deployment to complete. If the application is not fully deployed, you will see an error message in the web browser. Refresh the browser to see the deployed application.

Clean up

To avoid incurring charges to your Google Cloud Platform account for the resources used in this quickstart:

  1. Go to the Projects page in the console:

    Go to the Projects page

  2. Click the trash can icon next to the project you created for this Quickstart.

This shuts down the project and schedules it for deletion.

What's next

Send feedback about...

Cloud Shell