Instance

class Instance : KotlinCustomResource

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

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.notebooks.Instance;
import com.pulumi.gcp.notebooks.InstanceArgs;
import com.pulumi.gcp.notebooks.inputs.InstanceVmImageArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var instance = new Instance("instance", InstanceArgs.builder()
.location("us-west1-a")
.machineType("e2-medium")
.vmImage(InstanceVmImageArgs.builder()
.imageFamily("tf-latest-cpu")
.project("deeplearning-platform-release")
.build())
.build());
}
}

Notebook Instance Basic Container

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.notebooks.Instance;
import com.pulumi.gcp.notebooks.InstanceArgs;
import com.pulumi.gcp.notebooks.inputs.InstanceContainerImageArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var instance = new Instance("instance", InstanceArgs.builder()
.containerImage(InstanceContainerImageArgs.builder()
.repository("gcr.io/deeplearning-platform-release/base-cpu")
.tag("latest")
.build())
.location("us-west1-a")
.machineType("e2-medium")
.metadata(Map.of("proxy-mode", "service_account"))
.build());
}
}

Notebook Instance Basic Gpu

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.notebooks.Instance;
import com.pulumi.gcp.notebooks.InstanceArgs;
import com.pulumi.gcp.notebooks.inputs.InstanceAcceleratorConfigArgs;
import com.pulumi.gcp.notebooks.inputs.InstanceVmImageArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var instance = new Instance("instance", InstanceArgs.builder()
.acceleratorConfig(InstanceAcceleratorConfigArgs.builder()
.coreCount(1)
.type("NVIDIA_TESLA_T4")
.build())
.installGpuDriver(true)
.location("us-west1-a")
.machineType("n1-standard-1")
.vmImage(InstanceVmImageArgs.builder()
.imageFamily("tf-latest-gpu")
.project("deeplearning-platform-release")
.build())
.build());
}
}

Notebook Instance Full

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.ComputeFunctions;
import com.pulumi.gcp.compute.inputs.GetNetworkArgs;
import com.pulumi.gcp.compute.inputs.GetSubnetworkArgs;
import com.pulumi.gcp.notebooks.Instance;
import com.pulumi.gcp.notebooks.InstanceArgs;
import com.pulumi.gcp.notebooks.inputs.InstanceVmImageArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var myNetwork = ComputeFunctions.getNetwork(GetNetworkArgs.builder()
.name("default")
.build());
final var mySubnetwork = ComputeFunctions.getSubnetwork(GetSubnetworkArgs.builder()
.name("default")
.region("us-central1")
.build());
var instance = new Instance("instance", InstanceArgs.builder()
.location("us-central1-a")
.machineType("e2-medium")
.vmImage(InstanceVmImageArgs.builder()
.project("deeplearning-platform-release")
.imageFamily("tf-latest-cpu")
.build())
.instanceOwners("my@service-account.com")
.serviceAccount("my@service-account.com")
.installGpuDriver(true)
.bootDiskType("PD_SSD")
.bootDiskSizeGb(110)
.noPublicIp(true)
.noProxyAccess(true)
.network(myNetwork.applyValue(getNetworkResult -> getNetworkResult.id()))
.subnet(mySubnetwork.applyValue(getSubnetworkResult -> getSubnetworkResult.id()))
.labels(Map.of("k", "val"))
.build());
}
}

Import

Instance can be imported using any of these accepted formats

$ pulumi import gcp:notebooks/instance:Instance default projects/{{project}}/locations/{{location}}/instances/{{name}}
$ pulumi import gcp:notebooks/instance:Instance default {{project}}/{{location}}/{{name}}
$ pulumi import gcp:notebooks/instance:Instance default {{location}}/{{name}}

Properties

Link copied to clipboard

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.

Link copied to clipboard
val bootDiskSizeGb: Output<Int>?

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.

Link copied to clipboard
val bootDiskType: Output<String>?

Possible disk types for notebook instances. Possible values are: DISK_TYPE_UNSPECIFIED, PD_STANDARD, PD_SSD, PD_BALANCED, PD_EXTREME.

Link copied to clipboard

Use a container image to start the notebook instance. Structure is documented below.

Link copied to clipboard
val createTime: Output<String>

Instance creation time

Link copied to clipboard

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

Link copied to clipboard
val dataDiskSizeGb: Output<Int>?

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.

Link copied to clipboard
val dataDiskType: Output<String>?

Possible disk types for notebook instances. Possible values are: DISK_TYPE_UNSPECIFIED, PD_STANDARD, PD_SSD, PD_BALANCED, PD_EXTREME.

Link copied to clipboard
val diskEncryption: Output<String>?

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

Link copied to clipboard
val id: Output<String>
Link copied to clipboard

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.

Link copied to clipboard
val instanceOwners: Output<List<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.

Link copied to clipboard
val kmsKey: Output<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}

Link copied to clipboard
val labels: Output<Map<String, 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" }.

Link copied to clipboard
val location: Output<String>

A reference to the zone where the machine resides.

Link copied to clipboard
val machineType: Output<String>

A reference to a machine type which defines VM kind.

Link copied to clipboard
val metadata: Output<Map<String, 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" }.

Link copied to clipboard
val name: Output<String>

The name specified for the Notebook instance.

Link copied to clipboard
val network: Output<String>

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

Link copied to clipboard
val nicType: Output<String>?

The type of vNIC driver. Possible values are: UNSPECIFIED_NIC_TYPE, VIRTIO_NET, GVNIC.

Link copied to clipboard
val noProxyAccess: Output<Boolean>?

The notebook instance will not register with the proxy..

Link copied to clipboard
val noPublicIp: Output<Boolean>?

No public IP will be assigned to this instance.

Link copied to clipboard

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

Link copied to clipboard

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).

Link copied to clipboard
val project: Output<String>

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Link copied to clipboard
val proxyUri: Output<String>

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 pulumi up -refresh-only to await the population of this value.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Reservation Affinity for consuming Zonal reservation. Structure is documented below.

Link copied to clipboard
val serviceAccount: Output<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.

Link copied to clipboard

Optional. The URIs of service account scopes to be included in Compute Engine instances. If not specified, the following scopes are defined:

Link copied to clipboard

A set of Shielded Instance options. Check Images using supported Shielded VM features Not all combinations are valid Structure is documented below.

Link copied to clipboard
val state: Output<String>

The state of this instance.

Link copied to clipboard
val subnet: Output<String>

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

Link copied to clipboard
val tags: Output<List<String>>?

The Compute Engine tags to add to instance.

Link copied to clipboard
val updateTime: Output<String>

Instance update time.

Link copied to clipboard
val urn: Output<String>
Link copied to clipboard
val vmImage: Output<InstanceVmImage>?

Use a Compute Engine VM image to start the notebook instance. Structure is documented below.