Quickstart

This page shows you how to use the datalab command line tool to set up and run Google Cloud Datalab on Google Cloud Platform. The simplest and quickest way to run this quickstart is by using the Google Cloud Shell from the Google Cloud Platform Console.

Google Cloud Platform console

Before you begin

Install the Google Cloud SDK and the datalab tool

Cloud Shell

No install necessary since Google Cloud Shell has the Cloud SDK (including the `gcloud` command-line tool) and the `datalab` tool pre-installed.

Mac/Windows/Linux

  1. Install the `gcloud` command-line tool by installing the Google Cloud SDK.
  2. Install the `datalab` command line tool
    gcloud components install datalab
         
  3. Obtain account access to Google Cloud Platform
    gcloud auth login
           

Choose a project

To complete this quickstart, you need a Google Cloud Platform project that you own and which has the Google Compute Engine API enabled. You can see a list of your projects together with their project IDs by running:

gcloud projects list

Configure the gcloud tool to use your selected project:

gcloud config set core/project project_id

Choose a zone

Select a zone for your Cloud Datalab instance (see Choosing a region and zone). Run the following command to configure the gcloud tool to use your selected zone:

gcloud config set compute/zone zone

Create and connect to a Cloud Datalab instance

Cloud Shell

  1. Run `datalab` to create a Cloud Datalab VM. Make sure to select a unique name for the instance.
    datalab create instance_name
    
  2. The previous command creates a connection to your instance. Use that connection to open your browser to the Cloud Datalab notebook listing page by selecting Cloud Shell Web preview→Change port→Port 8081.

Mac/Windows/Linux

  1. Run `datalab` to create a Cloud Datalab VM. Make sure to select a unique name for the instance.
    datalab create instance_name
    
  2. The previous command creates a connection to your instance. Use that connection to open your browser to the Cloud Datalab notebook listing page by navigating to http://localhost:8081.

The connection to your Datalab instance remains open for as long as the datalab command is active. If the terminal command window used for running the datalab command is closed or interrupted, the connection to your Cloud Datalab VM will terminate, and you will need to run datalab connect instance_name to reestablish the connection to your VM.

Cloud Datalab VM Caveats: Note the following caveats associated with this Cloud Datalab VM solution:

  • One Cloud Datalab VM is required per user. Each VM contains a clone of datalab-notebooks, and is intended to be used by a single user.
  • Service account credentials are used for accessing Google Cloud Platform services, such as Google BigQuery and Google Cloud Storage. User credentials cannot be used with this Cloud Datalab VM solution (VMs are shared resources within a project, and therefore are unsuitable for managing individual user tokens). Click the user icon in the top-right corner to display the account used by Cloud Datalab in this scenario. You will need to grant this service account permission to access any Google Cloud Platform services that you will use with this Cloud Datalab VM solution.

Clean up

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

  1. Delete the Google Compute Engine VM when you are finished exploring Cloud Datalab.
    datalab delete instance_name
    

What's next

  1. Browse the /docs/intro Cloud Datalab notebook folder to become familiar with the capabilities of Cloud Datalab. You will find tutorials and samples for using Google Cloud Platform services and for performing common data analysis tasks.
  2. You can view the datalab server VM logs with the Cloud Platform Console logs viewer.
  3. Read Cloud Datalab How-to Guides.
  4. Learn more about the options available in the datalab command line tool by running datalab --help.
  5. Learn about Using Datalab in a team environment.

Send feedback about...

Google Cloud Datalab Documentation