Create a managed notebooks instance
This page shows you how to create a managed notebooks instance by using the Google Cloud console or the Google Cloud CLI. While creating your instance, you can configure your instance's hardware, encryption type, network, and other details.
Before you begin
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Notebooks API.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Notebooks API.
Create an instance with default properties
You can create a managed notebooks instance by using either the Google Cloud console or the gcloud CLI:
Console
In the Google Cloud console, go to the Managed notebooks page.
Click
New notebook.In the Notebook name field, enter a name for your instance. The name must start with a letter followed by up to 62 lowercase letters, numbers, or hyphens (-), and cannot end with a hyphen.
Click the Region list, and select a region for your instance.
Choose a permission option to define which users can access the managed notebooks instance:
Service Account: This option grants access to all users who have access to the Compute Engine service account that you link to the runtime. To specify your own service account, clear the Use Compute Engine default service account checkbox, and enter the service account email address that you want to use. For more information about service accounts, see Types of service accounts.
Single User: This option grants access to only a specific user. In the User email field, enter the user account email address of the user who will use the managed notebooks instance.
To learn more about granting access, see Manage access.
Click Create.
Vertex AI Workbench automatically starts the instance. When the instance is ready to use, Vertex AI Workbench activates an Open JupyterLab link.
gcloud
Before using any of the command data below, make the following replacements:
-
INSTANCE_NAME
: The name of your managed notebooks instance; must start with a letter followed by up to 62 lowercase letters, numbers, or hyphens (-), and cannot end with a hyphen PROJECT_ID
: Your project IDLOCATION
: The region where you want your instance to be located-
ACCESS_MODE
: the access mode that you want to use; for example,SINGLE_USER
orSERVICE_ACCOUNT
-
OWNER_EMAIL_ADDRESS
: the email address of the single user or service account that needs access to the instance's JupyterLab interface -
MACHINE_TYPE
: the machine type of your instance's VM
Execute the following command:
Linux, macOS, or Cloud Shell
gcloud notebooks runtimes create INSTANCE_NAME --project=PROJECT_ID --location=LOCATION --runtime-access-type=ACCESS_MODE --runtime-owner=OWNER_EMAIL_ADDRESS --machine-type=MACHINE_TYPE
Windows (PowerShell)
gcloud notebooks runtimes create INSTANCE_NAME --project=PROJECT_ID --location=LOCATION --runtime-access-type=ACCESS_MODE --runtime-owner=OWNER_EMAIL_ADDRESS --machine-type=MACHINE_TYPE
Windows (cmd.exe)
gcloud notebooks runtimes create INSTANCE_NAME --project=PROJECT_ID --location=LOCATION --runtime-access-type=ACCESS_MODE --runtime-owner=OWNER_EMAIL_ADDRESS --machine-type=MACHINE_TYPE
For more information about the command for creating an instance from the command line, see the gcloud CLI documentation.
Vertex AI Workbench automatically starts the instance after creation. When the instance is ready to use, you can access it from the Google Cloud console.
Create an instance by using advanced settings
In the Google Cloud console, go to the Managed notebooks page.
Click
New notebook.In the Notebook name field, enter a name for your instance. The name must start with a letter followed by up to 62 lowercase letters, numbers, or hyphens (-), and cannot end with a hyphen.
Click the Region list, and select a region for your instance.
Choose a permission option to define which users can access the managed notebooks instance:
Service Account: This option grants access to all users who have access to the Compute Engine service account that you link to the runtime. To specify your own service account, clear the Use Compute Engine default service account checkbox, and enter the service account email address that you want to use. For more information about service accounts, see Types of service accounts.
Single User: This option grants access to only a specific user. In the User email field, enter the user account email address of the user who will use the managed notebooks instance.
To learn more about granting access, see Manage access.
Click Advanced settings and complete the dialog using the directions in the following sections.
Use custom Docker images
To run notebook files in a custom Docker container, add the custom Docker container image to your managed notebooks instance.
The custom Docker container image must be located in Artifact Registry. You must have access to the container image.
In the Environment section, in Custom Docker images, select the Provide custom Docker images checkbox.
Enter a Docker container image path, or click Select to add one from Artifact Registry.
To add another custom Docker image, click
Add another Docker image, and repeat these steps.
Configure hardware
Select a hardware configuration for your environment. You can change this later from the JupyterLab user interface.
Confirm GPU availability
GPU accelerator availability is based on region, machine type, and the number of GPUs that you want. You might want to confirm availability by using the following resources:
- GPU regions and zones availability. The accelerator type that you want must be available in your instance's zone.
- NVIDIA® A100 GPUs. Check GPU availability for your machine type.
Configure the hardware
To configure your hardware, complete the following:
In the Hardware configuration section, select a Machine type.
If you want to use GPUs, select a GPU type. If you don't see the GPU type that you want, check GPU availability for your machine type and zone.
If you chose to use GPUs, select a Number of GPUs, and then select Install NVIDIA GPU driver automatically for me.
Select a Data disk type and Data disk size in GB.
To use the operating system's default trash behavior, select the Delete to trash checkbox. If you use the default trash behavior, files deleted by using the JupyterLab user interface are recoverable but these deleted files do use disk space.
Select encryption type
Choose either the default Google-owned and Google-managed encryption key or a Customer-managed encryption key (CMEK). To learn more about using CMEK with managed notebooks, see Use customer-managed encryption keys.
In the Disk encryption section, select either the default Google-managed encryption key or select Customer-managed encryption key (CMEK).
If you select Customer-managed encryption key (CMEK), click the list, and select your customer-managed key.
If the key that you want to use is not in the list, enter your encryption key's resource ID.
To create a customer-managed encryption key, see Creating symmetric encryption keys.
Enable idle shutdown
Idle shutdown is enabled by default to shut down your instance after 180 minutes of inactivity. You can change the number of minutes of inactivity before shutdown, or you can disable idle shutdown. To learn more, see Idle shutdown.
To change the number of minutes before shutdown, in the Idle shutdown section, in the Time of inactivity before shutdown (Minutes) field, change the value to an integer from 10 through 1440.
To disable idle shutdown, in the Idle shutdown section, clear Enable Idle Shutdown.
Configure your network
By default, your managed notebooks instance uses a Google-managed VPC network, which requires no configuration. If you want to, you can instead specify a VPC network located within your project or a network that is shared with you. If you specify a network, the network requires a private services access connection. The network must also have internet access, or you must enable Private Google Access for the network.
In the Networking section, select either Networks in this project or Networks shared with me.
In the Network field, select the network that you want to use.
In the Subnetwork field, select the subnetwork that you want to use.
To enable an external IP address, select the Enable external IP address checkbox. If the specified network doesn't have internet access, or if you don't enable the external IP address, you must enable Private Google Access for the network in order to use this instance.
If you have not already configured a private services access connection for this network, click Set up connection and complete the following:
In the Create a private services access connection dialog, enable the Service Networking API, and then click Enable API. If the Service Networking API is already enabled, click Continue.
In the Allocate an IP range section, complete the dialog to select one or more existing IP ranges, create a new IP range, or use an automatically allocated IP range.
When you have finished, click Continue.
In the Create a connection section, review the network and allocated IP range that you selected, and then click Create connection.
Configure security options
Enable or disable the following options:
- nbconvert:
nbconvert
lets users export and download a notebook file as a different file type, such as HTML, PDF, or LaTeX. - File downloading from Notebook UI: This setting lets users download files from the JupyterLab user interface.
- Terminal: This enables terminal access to your managed notebooks instance from within the JupyterLab user interface.
Finish creating the instance
Click Create.
Vertex AI Workbench automatically starts the instance. When the instance is ready to use, Vertex AI Workbench activates an Open JupyterLab link.
Create an instance by using Terraform
You can create a managed notebooks instance by using the
google_notebooks_runtime
Terraform resource. Use the following sample to create a
new managed notebooks instance named notebooks-runtime-basic
.
To learn how to apply or remove a Terraform configuration, see Basic Terraform commands.
Open JupyterLab
After you create your instance, Vertex AI Workbench automatically starts the instance. When the instance is ready to use, Vertex AI Workbench activates an Open JupyterLab link.
Next to your managed notebooks instance's name, click Open JupyterLab.
The first time you access a managed notebooks instance's JupyterLab user interface, you must grant the gcloud CLI permission to access your data and authenticate your managed notebooks instance.
In the Authenticate your managed notebook dialog, click the button to get an authentication code.
Choose an account and click Allow. Copy the authentication code.
In the Authenticate your managed notebook dialog, paste the authentication code, and then click Authenticate.
Your managed notebooks instance opens JupyterLab.
Open a new notebook file
Select File > New > Notebook.
In the Select kernel dialog, select Python, and then click Select.
Your new notebook file opens.
What's next
Try one of the tutorials that is included in your new managed notebooks instance. In the JupyterLab
File Browser, open the tutorials folder, and open one of the notebook files.