Google Cloud AI Notebooks Instance

This page shows how to write Terraform for Cloud AI Notebooks Instance and write them securely.

google_notebooks_instance (Terraform)

The Instance in Cloud AI Notebooks can be configured in Terraform with the resource name google_notebooks_instance. The following sections describe 3 examples of how to use the resource and its parameters.

Example Usage from GitHub

notebook_justin.tf#L1
resource "google_notebooks_instance" "instance" {
  name = "notebooks-instance"
  location = "europe-west2-a"
  machine_type = "e2-medium"

  vm_image {
main.tf#L1
resource "google_notebooks_instance" "instance" {
  provider = google-beta
  name = var.name
  location = var.zone
  machine_type = var.machine_type

main.tf#L100
resource "google_notebooks_instance" "nb-glider-data-processing" {
  name          = "glider-data-processing"
  machine_type  = "n1-standard-1" #1, 2, 4, 8, 16, 32
  location      = var.zone

  vm_image {

Review your Terraform file for Google best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

The size of the boot disk in GB attached to this instance, up to a maximum of 64000 GB (64 TB). The minimum recommended value is 100 GB. If not specified, this defaults to 100.

Possible disk types for notebook instances. Possible values: ["DISK_TYPE_UNSPECIFIED", "PD_STANDARD", "PD_SSD", "PD_BALANCED"]

Instance creation time

Specify a custom Cloud Storage path where the GPU driver is stored. If not specified, we'll automatically choose from official GPU drivers.

The size of the data disk in GB attached to this instance, up to a maximum of 64000 GB (64 TB). You can choose the size of the data disk based on how big your notebooks and data are. If not specified, this defaults to 100.

Possible disk types for notebook instances. Possible values: ["DISK_TYPE_UNSPECIFIED", "PD_STANDARD", "PD_SSD", "PD_BALANCED"]

Disk encryption method used on the boot and data disks, defaults to GMEK. Possible values: ["DISK_ENCRYPTION_UNSPECIFIED", "GMEK", "CMEK"]

Whether the end user authorizes Google Cloud to install GPU driver on this instance. If this field is empty or set to false, the GPU driver won't be installed. Only applicable to instances with GPUs.

The list of owners of this instance after creation. Format: alias@example.com. Currently supports one owner only. If not specified, all of the service account users of your VM instance's service account can use the instance.

The KMS key used to encrypt the disks, only applicable if diskEncryption is CMEK. Format: projects/[project_id]/locations/[location]/keyRings/[key_ring_id]/cryptoKeys/[key_id]

  • labels optional computed - map from string to string

Labels to apply to this instance. These can be later modified by the setLabels method. An object containing a list of "key": value pairs. Example: [ "name": "wrench", "mass": "1.3kg", "count": "3" ].

A reference to the zone where the machine resides.

A reference to a machine type which defines VM kind.

  • metadata optional - map from string to string

Custom metadata to apply to this instance. An object containing a list of "key": value pairs. Example: [ "name": "wrench", "mass": "1.3kg", "count": "3" ].

The name specified for the Notebook instance.

The name of the VPC that this instance is in. Format: projects/[project_id]/global/networks/[network_id]

The notebook instance will not register with the proxy..

No public IP will be assigned to this instance.

If true, the data disk will not be auto deleted when deleting the instance.

Path to a Bash script that automatically runs after a notebook instance fully boots up. The path must be a URL or Cloud Storage path (gs://path-to-file/file-name).

The proxy endpoint that is used to access the Jupyter notebook.

The service account on this instance, giving access to other Google Cloud services. You can use any service account within the same project, but you must have the service account user permission to use the instance. If not specified, the Compute Engine default service account is used.

Optional. The URIs of service account scopes to be included in Compute Engine instances. If not specified, the following scopes are defined: - https://www.googleapis.com/auth/cloud-platform - https://www.googleapis.com/auth/userinfo.email

  • state optional computed - string

The state of this instance.

  • subnet optional computed - string

The name of the subnet that this instance is in. Format: projects/[project_id]/regions/[region]/subnetworks/[subnetwork_id]

  • tags optional - list of string

The Compute Engine tags to add to runtime.

Instance update time.

  • accelerator_config list block

    Count of cores of this accelerator.

    Type of this accelerator. Possible values: ["ACCELERATOR_TYPE_UNSPECIFIED", "NVIDIA_TESLA_K80", "NVIDIA_TESLA_P100", "NVIDIA_TESLA_V100", "NVIDIA_TESLA_P4", "NVIDIA_TESLA_T4", "NVIDIA_TESLA_T4_VWS", "NVIDIA_TESLA_P100_VWS", "NVIDIA_TESLA_P4_VWS", "NVIDIA_TESLA_A100", "TPU_V2", "TPU_V3"]

  • container_image list block

    The path to the container image repository. For example: gcr.io/[project_id]/[imageName]

    • tag optional - string

    The tag of the container image. If not specified, this defaults to the latest tag.

  • shielded_instance_config list block

    Defines whether the instance has integrity monitoring enabled. Enables monitoring and attestation of the boot integrity of the instance. The attestation is performed against the integrity policy baseline. This baseline is initially derived from the implicitly trusted boot image when the instance is created. Enabled by default.

    Defines whether the instance has Secure Boot enabled. Secure Boot helps ensure that the system only runs authentic software by verifying the digital signature of all boot components, and halting the boot process if signature verification fails. Disabled by default.

    Defines whether the instance has the vTPM enabled. Enabled by default.

  • timeouts single block
  • vm_image list block

    Use this VM image family to find the image; the newest image in this family will be used.

    Use VM image name to find the image.

    The name of the Google Cloud project that this VM image belongs to. Format: projects/[project_id]

Explanation in Terraform Registry

A Cloud AI Platform Notebook instance.

Note: Due to limitations of the Notebooks Instance API, many fields in this resource do not properly detect drift. These fields will also not appear in state once imported. To get more information about Instance, see:

Frequently asked questions

What is Google Cloud AI Notebooks Instance?

Google Cloud AI Notebooks Instance is a resource for Cloud AI Notebooks of Google Cloud Platform. Settings can be wrote in Terraform.

Where can I find the example code for the Google Cloud AI Notebooks Instance?

For Terraform, the mabel-dev/infrastructure, marcelopicarelli/google-datalake and us-amlr/amlr-gcp-terraform source code examples are useful. See the Terraform Example section for further details.

security-icon

Automate config file reviews on your commits

Fix issues in your infrastructure as code with auto-generated patches.