Using Cloud Datalab in a team environment

This page describes how to use Cloud Datalab as part of a team.

Create instances for each team member

Cloud Datalab instances are single-user environments, therefore each member of your team needs their own instance. The normal access rules for Google Compute Engine VMs apply—for example, project editors can SSH into the VM—but having more than one Cloud Datalab user per instance is not supported. For information on ways to conserve compute resources that are supported, see Managing the lifecycle of a Cloud Datalab instance.

There are two ways to create VM instances for team members:

  • A project owner creates instances for other team members.
  • Each team member creates their own instance.

With either approach, a recommended practice is to include the user’s name in the name of the instance, so that you can easily associate an instance with a user.

Let's look at each approach.

Project owner creates instances for other team members

A project owner can create a Cloud Datalab instance for each team member by using the datalab create command. To do this, the project owner must pass in an additional --for-user flag specifying the email address of the Cloud Datalab user.

In order to connect to their instance, the datalab user must have at least the following IAM roles:

  • roles/compute.instanceAdmin.v1
  • roles/iam.serviceAccountUser for the service account attached to the user's Cloud Datalab instance

As an option, you can create a separate service account for each user, and then attach that service account (instead of the default service account) to the user’s instance by passing the --service-account flag to the datalab create command.

Each team member creates their own instance

If each team member is a project editor, they can create their own Cloud Datalab instances.

Use the automatically created git repository for sharing notebooks

The first time that datalab create is run in a project, it creates a Cloud Source Repository in the project named datalab-notebooks. You can browse this repo from the Google Cloud Console Repositories page.

Each Cloud Datalab instance created in the project will clone the datalab-notebooks repository, if it exists, into the datalab/notebooks directory. That repository is in the same project as the Datalab instance, and you can manage it via the Cloud Console. See Working with notebooks for information on source control and sharing notebooks.