A Notebooks (JupyterLab) instance is a Deep Learning virtual machine instance with the latest machine learning and data science libraries pre-installed, with the option to include Nvidia GPUs for hardware acceleration.
Before you begin
Follow the steps in Before you begin to create a Google Cloud project and enable the Notebooks API.
Create a Notebooks instance with default propertiesTo create a Notebooks instance with default properties, complete the following steps. To specify properties for your instance, see Create a Notebooks instance with specific properties or go to notebook.new to go directly to the Advanced options instance creation dialog box.
Go to the Notebooks page in the Google Cloud Console.
ClickNew Instance, select an instance type, and then choose whether to include a GPU.
If you choose to include a GPU, you must select the option to Install NVIDIA GPU driver automatically for me. You can adjust the number of GPUs later if you need to. For information on adjusting the number of GPUs, see Manage hardware accelerators for a notebook.
Notebooks creates a new instance based on your selected framework. An Open JupyterLab link becomes active when it's ready to use.
Create a Notebooks instance with specific properties
If you prefer to create an instance with properties other than those provided by the default instance types, you can create a new instance and specify your preferred properties.
To create a Notebooks instance and specify the properties for your instance, follow these steps:
Go to the Notebooks page in the Google Cloud Console. Or go to notebook.new, and then skip to step 3.
ClickNew Instance, and then select Customize instance.
On the Create a notebook instance page, provide the following information for your new instance:
- Instance name: Provide a name for your new instance.
- Region: Select a region for the new instance. Select the region that is geographically closest to you for best network performance.
- Zone: Select a zone within the region that you selected.
- Environment: Select the operating system and environment that you want to use.
- Script: Select a path to a script that will be run once the instance is created.
The path must be a URL or Cloud Storage path (for example,
gs://<var>PATH_TO_FILE</var>/<var>FILE_NAME</var>). Note that the script will only run the very first time the notebook instance is created.
- Custom metadata: Provide custom metadata keys for the instance if needed.
- Machine type: Select the number of CPUs and amount of RAM for your new instance. Notebooks provides monthly cost estimates for each machine type that you select.
GPUs: Select the GPU type and Number of GPUs for your new instance. For information about the different GPUS, see GPUs on Compute Engine.
Select the option to Install NVIDIA GPU driver automatically for me.
You can modify the GPU type and number of GPUs for your instance after it is created. For more information, see Manage hardware accelerators for a notebook.
If you want to change the default boot disk settings, expand the Disk(s) section, and then select the Boot disk type and Boot disk size in GB that you want. See Storage options to learn more about disk types.
If you want to change the encryption settings to use customer-managed encryption keys (CMEK), see Using customer-managed encryption keys (CMEK).
If you want to change network settings, such as to select a Virtual Private Cloud, disable proxy access, or disable the external IP address, complete the following steps:
Expand the Networking section.
Select either Networks in this project or Networks shared with me.
On the Network menu, select the network that you want. You can select a VPC network, as long as the network has Private Google Access enabled or can access the internet. For more information, see network configuration options.
On the Subnetwork menu, select the subnetwork that you want.
If you want to disable the external IP address, set the External IP menu to None.
If you want to disable proxy access, clear the checkbox next to Allow proxy access when it's available.
If you want to grant access to all users who have access to a specific Compute Engine service account or to a specific user, expand the Permission section and complete one of the following steps:
To grant access to a specific service account, click the Access to JupyterLab menu, and select Other service account. Then fill out the Service account field. Learn more about service accounts.
To grant access to a single user, click the Access to JupyterLab menu, and select Single user only. Then fill out the User email field.
If you want to install extensions on the notebook instance, expand the Extensions section and complete the following steps:
Click Select Extensions.
Select the extensions that you want to install.
If you want the instance to be auto upgraded to a new environment version when made available, expand the Environment upgrade section and complete the following steps:
Select Enable environement auto-upgrade.
Select the frequency of upgrade. It can be set on a weekly or a monthly cadence along with a time frame of 1 hour during which the upgrade will be performed.
Notebooks creates a new instance based on your specified properties. An Open JupyterLab link becomes active when it's ready to use.
Create a Notebooks instance from the command line
To create a Notebooks instance from the command line, complete the following steps.
Run the following
gcloud notebooks instances create INSTANCE_NAME \ --vm-image-project=deeplearning-platform-release \ --vm-image-family=VM_IMAGE_FAMILY \ --machine-type=MACHINE_TYPE \ --location=LOCATION
Replace the following:
Access your instance from the Notebooks console.
To see all available commands for creating an instance from the command line, look at the gcloud docs.
The instance is created with an external IP address by default. If you create an instance without an external IP address, you must specify a subnet that has Private Google Access enabled. For more information, see networking configuration options.
Determine who has access to the JupyterLab instance
Unless you granted access to a specific service account or a single user, anyone that has editor permissions to your Google Cloud project can access the notebook.
If you granted access to a specific service account, anyone who has access to that service account can access the JupyterLab instance. Note that you will not have access to the JupyterLab instance unless you also have access to the specified service account.
If you granted access to a single user, that user is the only one who has access to the JupyterLab instance. Note that you will not have access yourself.
Open the notebookComplete these steps to open a Notebooks instance:
On the Notebooks page in the Google Cloud Console, click Open JupyterLab to open the notebook.
Notebooks opens your notebook.
If you visit the
VM instance details dialog in the console you will notice that
the Jupyterlab instance has
tags automatically assigned.
This allow you to manage network access to and from your instances by referencing these tags in your VPC networking firewall rules.
Network configuration options
A Notebooks instance needs to access service endpoints that are outside your VPC network.
You can provide this access in one of the following ways:
Assign an external IP address to the Notebooks instance. This is done automatically when you create a new instance with default properties. Make sure your environment meets the requirements for accessing Google APIs and services.
If you use the
restricted.googleapis.com VIP to
provide access to the service endpoints,
add DNS entries for each of the required service
If you encounter a problem when you create a notebook, see Troubleshooting notebooks for help with common issues.
Install dependencies on your new Notebooks instance.
Learn about monitoring the health status of your Notebooks instance.