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
resource "google_notebooks_instance" "instance" {
name = "notebooks-instance"
location = "europe-west2-a"
machine_type = "e2-medium"
vm_image {
resource "google_notebooks_instance" "instance" {
provider = google-beta
name = var.name
location = var.zone
machine_type = var.machine_type
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 {
Parameters
-
boot_disk_size_gboptional - number
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.
-
boot_disk_typeoptional - string
Possible disk types for notebook instances. Possible values: ["DISK_TYPE_UNSPECIFIED", "PD_STANDARD", "PD_SSD", "PD_BALANCED"]
-
create_timeoptional computed - string
Instance creation time
-
custom_gpu_driver_pathoptional - string
Specify a custom Cloud Storage path where the GPU driver is stored. If not specified, we'll automatically choose from official GPU drivers.
-
data_disk_size_gboptional - number
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.
-
data_disk_typeoptional - string
Possible disk types for notebook instances. Possible values: ["DISK_TYPE_UNSPECIFIED", "PD_STANDARD", "PD_SSD", "PD_BALANCED"]
-
disk_encryptionoptional - string
Disk encryption method used on the boot and data disks, defaults to GMEK. Possible values: ["DISK_ENCRYPTION_UNSPECIFIED", "GMEK", "CMEK"]
-
idoptional computed - string -
install_gpu_driveroptional - bool
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.
-
instance_ownersoptional - list of string
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.
-
kms_keyoptional - string
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]
-
labelsoptional 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" ].
-
locationrequired - string
A reference to the zone where the machine resides.
-
machine_typerequired - string
A reference to a machine type which defines VM kind.
-
metadataoptional - 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" ].
-
namerequired - string
The name specified for the Notebook instance.
-
networkoptional computed - string
The name of the VPC that this instance is in. Format: projects/[project_id]/global/networks/[network_id]
-
no_proxy_accessoptional - bool
The notebook instance will not register with the proxy..
-
no_public_ipoptional - bool
No public IP will be assigned to this instance.
-
no_remove_data_diskoptional - bool
If true, the data disk will not be auto deleted when deleting the instance.
-
post_startup_scriptoptional - string
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.
-
service_accountoptional computed - string
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.
-
service_account_scopesoptional - list of string
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
-
stateoptional computed - string
The state of this instance.
-
subnetoptional computed - string
The name of the subnet that this instance is in. Format: projects/[project_id]/regions/[region]/subnetworks/[subnetwork_id]
-
tagsoptional - list of string
The Compute Engine tags to add to runtime.
-
update_timeoptional computed - string
Instance update time.
-
accelerator_configlist block-
core_countrequired - number
Count of cores of this accelerator.
-
typerequired - string
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_imagelist block-
repositoryrequired - string
The path to the container image repository. For example: gcr.io/[project_id]/[imageName]
-
tagoptional - string
The tag of the container image. If not specified, this defaults to the latest tag.
-
-
shielded_instance_configlist block-
enable_integrity_monitoringoptional - bool
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.
-
enable_secure_bootoptional - bool
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.
-
enable_vtpmoptional - bool
Defines whether the instance has the vTPM enabled. Enabled by default.
-
-
timeoutssingle block -
vm_imagelist block-
image_familyoptional - string
Use this VM image family to find the image; the newest image in this family will be used.
-
image_nameoptional - string
Use VM image name to find the image.
-
projectrequired - string
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:
- API documentation
- How-to Guides
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.