Table of contents:

Google Cloud datalab provides an interactive environment for model prototyping.

Enable Google Compute Engine and Cloud Source Repositories APIs

On a new account, enable Google Compute API and then the Cloud Source Repositories API before launching datalab.

APIs & Services Dashboard

Search for Compute Engine APIs

Enable Compute API

Enable Compute API.

Search for Cloud Source Repositories APIs

Search for Cloud Source Repositories APIs.

Enable Cloud Source Repositories API

Enable Cloud Source Repositories API.

Launch a Datalab Instance from gcloud

To launch a datalab instance,

  1. Open gcloud shell
  2. Create a datalab instance by running the command datalab create instance-name
  3. Accept all the defaults as the instance is provisioned
  4. Press Enter twice when asked to generate a passphrase.
  5. Click on the Web Preview at top-right of the gcloud window, click Change port and selet Port 8081, to start using Datalab.

Note: The instance-name must begin with a lowercase letter, and can have up to 63 lowercase letters, mixed with numbers and hyphens. The instance-name cannot end with a hyphen.

Open Cloud Shell

Open Cloud Shell.

Create Datalab Instance

Create Datalab Instance.

Select Zone

Select Zone.

Generate SSH keys

Generate SSH keys.

Select Port 8081

Select Port 8081.

Datalab Interface

Datalab Interface.

Open a notebook

To open a new notebook. Click on New Notebook at the top-left hand corner of the instance page.

Open a notebook.

Retrieving Code from Github into Datalab VM

(1). Log-in into the Datalab VM via ssh.

Compute Engine Dashboard.
Select VM Instance.

(2). Notebooks are stored in the disk location /mnt/disks/datalab-pd/content/datalab/notebooks. Change to the directory using the cd command and clone the repository from Github

cd /mnt/disks/datalab-pd/content/datalab/notebooks

Move notebook directory.

git clone

Git clone repository.

(3). The directory /mnt/disks/datalab-pd/content is mapped to the home directory in Datalab.

Notebook with repository.

Shutting down/ Deleting the instance

To shut down the instance,

  1. Open the Cloud Compute Dashboard
  2. Click the check-box to select the instance.
  3. Click Stop to shut down the instance. Shutting down the instance prevents the user from incurring unnecessary cost when the instance is not in use.
  4. Click Delete to delete the instance and detach the disk allocated to the compute engine. Only use this action when completely done with all work on that instance. This action is irreversible.

Open Cloud Compute Dashboard

Open Cloud Compute Dashboard.

Shut-down Datalab Instance

Shut-down Datalab Instance.

Delete Datalab Instance

Delete Datalab Instance.