Skip to content

googleNotebooksInstance

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:

Example Usage - Notebook Instance Basic

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
new google.notebooksInstance.NotebooksInstance(this, "instance", {
  location: "us-west1-a",
  machine_type: "e2-medium",
  name: "notebooks-instance",
  vm_image: [
    {
      image_family: "tf-latest-cpu",
      project: "deeplearning-platform-release",
    },
  ],
});

Example Usage - Notebook Instance Basic Container

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
new google.notebooksInstance.NotebooksInstance(this, "instance", {
  container_image: [
    {
      repository: "gcr.io/deeplearning-platform-release/base-cpu",
      tag: "latest",
    },
  ],
  location: "us-west1-a",
  machine_type: "e2-medium",
  metadata: [
    {
      "proxy-mode": "service_account",
      terraform: "true",
    },
  ],
  name: "notebooks-instance",
});

Example Usage - Notebook Instance Basic Gpu

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
new google.notebooksInstance.NotebooksInstance(this, "instance", {
  accelerator_config: [
    {
      core_count: 1,
      type: "NVIDIA_TESLA_T4",
    },
  ],
  install_gpu_driver: true,
  location: "us-west1-a",
  machine_type: "n1-standard-1",
  name: "notebooks-instance",
  vm_image: [
    {
      image_family: "tf-latest-gpu",
      project: "deeplearning-platform-release",
    },
  ],
});

Example Usage - Notebook Instance Full

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
const dataGoogleComputeNetworkMyNetwork =
  new google.dataGoogleComputeNetwork.DataGoogleComputeNetwork(
    this,
    "my_network",
    {
      name: "default",
    }
  );
const dataGoogleComputeSubnetworkMySubnetwork =
  new google.dataGoogleComputeSubnetwork.DataGoogleComputeSubnetwork(
    this,
    "my_subnetwork",
    {
      name: "default",
      region: "us-central1",
    }
  );
new google.notebooksInstance.NotebooksInstance(this, "instance", {
  boot_disk_size_gb: 110,
  boot_disk_type: "PD_SSD",
  install_gpu_driver: true,
  instance_owners: ["my@service-account.com"],
  labels: [
    {
      k: "val",
    },
  ],
  location: "us-central1-a",
  machine_type: "e2-medium",
  metadata: [
    {
      terraform: "true",
    },
  ],
  name: "notebooks-instance",
  network: dataGoogleComputeNetworkMyNetwork.id,
  no_proxy_access: true,
  no_public_ip: true,
  service_account: "my@service-account.com",
  subnet: dataGoogleComputeSubnetworkMySubnetwork.id,
  vm_image: [
    {
      image_family: "tf-latest-cpu",
      project: "deeplearning-platform-release",
    },
  ],
});

Argument Reference

The following arguments are supported:

  • name - (Required) The name specified for the Notebook instance.

  • machineType - (Required) A reference to a machine type which defines VM kind.

  • location - (Required) A reference to the zone where the machine resides.


  • postStartupScript - (Optional) 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).

  • instanceOwners - (Optional) 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.

  • serviceAccount - (Optional) 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.

  • serviceAccountScopes - (Optional) 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
  • acceleratorConfig - (Optional) The hardware accelerator used on this instance. If you use accelerators, make sure that your configuration has enough vCPUs and memory to support the machineType you have selected. Structure is documented below.

  • shieldedInstanceConfig - (Optional) A set of Shielded Instance options. Check [Images using supported Shielded VM features] Not all combinations are valid Structure is documented below.

  • nicType - (Optional) The type of vNIC driver. Possible values are unspecifiedNicType, virtioNet, and gvnic.

  • reservationAffinity - (Optional) Reservation Affinity for consuming Zonal reservation. Structure is documented below.

  • installGpuDriver - (Optional) 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.

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

  • bootDiskType - (Optional) Possible disk types for notebook instances. Possible values are diskTypeUnspecified, pdStandard, pdSsd, pdBalanced, and pdExtreme.

  • bootDiskSizeGb - (Optional) 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.

  • dataDiskType - (Optional) Possible disk types for notebook instances. Possible values are diskTypeUnspecified, pdStandard, pdSsd, pdBalanced, and pdExtreme.

  • dataDiskSizeGb - (Optional) 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.

  • noRemoveDataDisk - (Optional) If true, the data disk will not be auto deleted when deleting the instance.

  • diskEncryption - (Optional) Disk encryption method used on the boot and data disks, defaults to GMEK. Possible values are diskEncryptionUnspecified, gmek, and cmek.

  • kmsKey - (Optional) 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}

  • noPublicIp - (Optional) No public IP will be assigned to this instance.

  • noProxyAccess - (Optional) The notebook instance will not register with the proxy..

  • network - (Optional) The name of the VPC that this instance is in. Format: projects/{project_id}/global/networks/{network_id}

  • subnet - (Optional) The name of the subnet that this instance is in. Format: projects/{project_id}/regions/{region}/subnetworks/{subnetwork_id}

  • labels - (Optional) 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" }.

  • tags - (Optional) The Compute Engine tags to add to instance.

  • metadata - (Optional) Custom metadata to apply to this instance. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.

  • vmImage - (Optional) Use a Compute Engine VM image to start the notebook instance. Structure is documented below.

  • containerImage - (Optional) Use a container image to start the notebook instance. Structure is documented below.

  • project - (Optional) The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

The acceleratorConfig block supports:

  • type - (Required) Type of this accelerator. Possible values are acceleratorTypeUnspecified, nvidiaTeslaK80, nvidiaTeslaP100, nvidiaTeslaV100, nvidiaTeslaP4, nvidiaTeslaT4, nvidiaTeslaT4Vws, nvidiaTeslaP100Vws, nvidiaTeslaP4Vws, nvidiaTeslaA100, tpuV2, and tpuV3.

  • coreCount - (Required) Count of cores of this accelerator.

The shieldedInstanceConfig block supports:

  • enableIntegrityMonitoring - (Optional) 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.

  • enableSecureBoot - (Optional) 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.

  • enableVtpm - (Optional) Defines whether the instance has the vTPM enabled. Enabled by default.

The reservationAffinity block supports:

  • consumeReservationType - (Required) The type of Compute Reservation. Possible values are noReservation, anyReservation, and specificReservation.

  • key - (Optional) Corresponds to the label key of reservation resource.

  • values - (Optional) Corresponds to the label values of reservation resource.

The vmImage block supports:

  • project - (Required) The name of the Google Cloud project that this VM image belongs to. Format: projects/{project_id}

  • imageFamily - (Optional) Use this VM image family to find the image; the newest image in this family will be used.

  • imageName - (Optional) Use VM image name to find the image.

The containerImage block supports:

  • repository - (Required) The path to the container image repository. For example: gcr.io/{project_id}/{imageName}

  • tag - (Optional) The tag of the container image. If not specified, this defaults to the latest tag.

Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

  • id - an identifier for the resource with format projects/{{project}}/locations/{{location}}/instances/{{name}}

  • proxyUri - The proxy endpoint that is used to access the Jupyter notebook. Only returned when the resource is in a provisioned state. If needed you can utilize terraformApplyRefreshOnly to await the population of this value.

  • state - The state of this instance.

  • createTime - Instance creation time

  • updateTime - Instance update time.

Timeouts

This resource provides the following Timeouts configuration options:

  • create - Default is 20 minutes.
  • update - Default is 20 minutes.
  • delete - Default is 20 minutes.

Import

Instance can be imported using any of these accepted formats:

$ terraform import google_notebooks_instance.default projects/{{project}}/locations/{{location}}/instances/{{name}}
$ terraform import google_notebooks_instance.default {{project}}/{{location}}/{{name}}
$ terraform import google_notebooks_instance.default {{location}}/{{name}}

User Project Overrides

This resource supports User Project Overrides.