You can create an instance that uses Advanced Compute Images to provide an optimized environment for your artificial intelligence (AI), machine learning (ML), and high performance computing (HPC) workloads. You can use the following interfaces:
- Google Cloud CLI
- Cloud de Confiance console
- SchedMD's Slurm workload manager
To learn about Advanced Compute Images, see Overview of Advanced Compute Images.
Before you begin
-
If you haven't already, set up authentication.
Authentication verifies your identity for access to Cloud de Confiance by S3NS services and APIs. To run
code or samples from a local development environment, you can authenticate to
Compute Engine by selecting one of the following options:
Select the tab for how you plan to use the samples on this page:
Console
When you use the Cloud de Confiance console to access Cloud de Confiance by S3NS services and APIs, you don't need to set up authentication.
gcloud
-
Install the Google Cloud CLI, and then sign in to the gcloud CLI with your federated identity. After signing in, initialize the Google Cloud CLI by running the following command:
gcloud init - Set a default region and zone.
-
Required roles
To get the permissions that
you need to create instances,
ask your administrator to grant you the
Compute Instance Admin (v1) (roles/compute.instanceAdmin.v1) IAM role on the project.
For more information about granting roles, see Manage access to projects, folders, and organizations.
This predefined role contains the permissions required to create instances. To see the exact permissions that are required, expand the Required permissions section:
Required permissions
The following permissions are required to create instances:
-
compute.instances.createon the project -
To use a custom image to create the VM:
compute.images.useReadOnlyon the image -
To use a snapshot to create the VM:
compute.snapshots.useReadOnlyon the snapshot -
To use an instance template to create the VM:
compute.instanceTemplates.useReadOnlyon the instance template -
To specify a subnet for your VM:
compute.subnetworks.useon the project or on the chosen subnet -
To specify a static IP address for the VM:
compute.addresses.useon the project -
To assign an external IP address to the VM when using a VPC network:
compute.subnetworks.useExternalIpon the project or on the chosen subnet -
To assign a legacy network to the VM:
compute.networks.useon the project -
To assign an external IP address to the VM when using a legacy network:
compute.networks.useExternalIpon the project -
To set VM instance metadata for the VM:
compute.instances.setMetadataon the project -
To set tags for the VM:
compute.instances.setTagson the VM -
To set labels for the VM:
compute.instances.setLabelson the VM -
To set a service account for the VM to use:
compute.instances.setServiceAccounton the VM -
To create a new disk for the VM:
compute.disks.createon the project -
To attach an existing disk in read-only or read-write mode:
compute.disks.useon the disk -
To attach an existing disk in read-only mode:
compute.disks.useReadOnlyon the disk
You might also be able to get these permissions with custom roles or other predefined roles.
Quickstart
This tutorial describes the steps to create an A3 Ultra or A4 instance that uses Advanced Compute Images to configure and customize the guest OS.
Prerequisites
Before creating an instance, complete the following tasks for creating A3 Ultra and A4 instances:
- Obtain resource capacity for A3 Ultra or A4 instances.
- Create VPC networks.
- Optional: Create a compact placement policy
Create a compute instance with Advanced Compute Images
After you have completed the prerequisite tasks, you can use either of the following methods to create the instance.
Console
In the Cloud de Confiance console, go to the Create an instance page.
If prompted, select your project and click Continue. The Create an instance page appears and displays the Machine configuration pane.
In the Machine configuration pane, do the following:
- In the Name field, specify a name for your compute instance. For more information, see Resource naming convention.
Select a Region and Zone for the instance. If you have reserved the compute resources, the region and zone you select must match the region and zone of your reservation.
Click the GPUs tab, and then complete the following steps:
- In the GPU type list, select your GPU type.
- For A4 instances, select NVIDIA B200.
- For A3 Ultra instances, select NVIDIA H200 141GB.
- In the Number of GPUs list, select 8.
- Optional: Select a different machine type.
- In the GPU type list, select your GPU type.
In the navigation menu, click OS and storage. In the OS and storage pane that appears, complete the following steps:
- Click Change. The Boot disk pane appears and displays the Public images tab.
- In the Operating system list, select Advanced Compute Images.
- In the Version list, select the OS version.
- Optional: In the Boot disk type list, select the type of the boot disk.
- Optional: Specify additional properties for the boot disk, such as the disk size.
- Optional: For advanced configuration options, expand the Show advanced configurations section.
- To confirm your boot disk options and return to the Operating system and storage pane, click Select.
In the navigation menu, click Networking. The Networking pane appears.
Optional: To configure access to your instance from outside Cloud de Confiance by S3NS, complete the following steps:
- Go to the Firewall section.
To permit HTTP or HTTPS traffic to the compute instance, select Allow HTTP traffic or Allow HTTPS traffic.
The Compute Engine adds a network tag to your compute instance and creates the corresponding ingress firewall rule that allows all incoming traffic on
tcp:80(HTTP) ortcp:443(HTTPS). The network tag associates the firewall rule with the instance. For more information, see Firewall rules overview in the Cloud Next Generation Firewall documentation.
To create a multi-NIC instance, complete the following steps in the Networking pane. For a single-NIC instance, skip these steps.
- In the Network interfaces section, complete the following steps:
- Delete the default network interface. To delete the interface, click Delete.
Click Add a network interface. Use this option to add network interfaces that attach to the VPC networks that you created in the previous section. When you add the network interfaces, remember the following:
For a network interface that is used for host to host communication, select a regular VPC network and subnet from the Network and Subnetwork lists, and set the Network interface card list to gVNIC.
For a network interface that is used for GPU to GPU communication, select the RoCE VPC network and subnet from the Network and Subnetwork lists, and set the Network interface card list to MRDMA for these network interfaces.
In the navigation menu, click Advanced. Then, complete the following steps for the provisioning model that you want to use.
Flex-start
- In the Provisioning model section, in the VM provisioning model list, select Flex-start.
In the Enter number of hours field, enter the maximum amount of time that you want the compute instance to run. The value must be between
0.01(0.01 hours, or 36 seconds) or168(168 hours, or seven days).Select Set a wait time for VM creation.
Based on the zonal requirements for your workload, specify one of the following durations to help increase your chances that your VM creation request succeeds:
- Workloads with strict zonal requirements: if your workload requires you to create the VM in a specific zone, then specify a duration between 90 seconds and 2 hours. Longer durations give you higher chances of obtaining resources.
- Workloads without strict zonal requirements: if the VM can run in any zone within the region, then specify a duration of 0 seconds or clear the Set a wait time for VM creation checkbox. This action specifies that Compute Engine only allocates resources if they are immediately available. If the VM creation request fails because resources are unavailable, then retry the request in a different zone.
In the On VM termination field, select whether to stop or delete the compute instance at the end of its run duration:
- To delete the instance, select Delete.
- To stop the instance, select Stop.
Reservation-bound
Click Choose a reservation. This action opens a pane with a list of available reservations within your selected zone. From the reservation list, complete the following steps:
- Select the reservation that you want to use for the compute instance. You can also select a specific block within the reservation.
- Click Choose.
Spot
- In the Provisioning model section, select Spot from the VM provisioning model list.
Optional: To select the termination action that happens when Compute Engine preempts the Spot VM, complete the following steps:
- Expand the VM provisioning model advanced settings section.
- In the On VM termination list, select one of the following options:
- To stop the Spot VM during preemption, select Stop (default).
- To delete the Spot VM during preemption, select Delete.
To create and start the instance, click Create.
gcloud
To create the VM, use the
gcloud compute instances create command.
The parameters that you need to specify depend on the consumption option that you are using for this deployment. Select the tab that corresponds to your consumption option's provisioning model.
Flex-start
Before running the command, optionally add the flag for a compact placement policy.
gcloud compute instances create INSTANCE_NAME \
--machine-type=MACHINE_TYPE \
--image-family=IMAGE_FAMILY \
--image-project=IMAGE_PROJECT \
--zone=ZONE \
--boot-disk-type=hyperdisk-balanced \
--boot-disk-size=DISK_SIZE \
--scopes=cloud-platform \
--network-interface=nic-type=GVNIC,network=GVNIC_NAME_PREFIX-net-0,subnet=GVNIC_NAME_PREFIX-sub-0 \
--network-interface=nic-type=GVNIC,network=GVNIC_NAME_PREFIX-net-1,subnet=GVNIC_NAME_PREFIX-sub-1,no-address
--network-interface=nic-type=MRDMA,network=RDMA_NAME_PREFIX-mrdma,subnet=RDMA_NAME_PREFIX-mrdma-sub-0,no-address \
--network-interface=nic-type=MRDMA,network=RDMA_NAME_PREFIX-mrdma,subnet=RDMA_NAME_PREFIX-mrdma-sub-1,no-address \
--network-interface=nic-type=MRDMA,network=RDMA_NAME_PREFIX-mrdma,subnet=RDMA_NAME_PREFIX-mrdma-sub-2,no-address \
--network-interface=nic-type=MRDMA,network=RDMA_NAME_PREFIX-mrdma,subnet=RDMA_NAME_PREFIX-mrdma-sub-3,no-address \
--network-interface=nic-type=MRDMA,network=RDMA_NAME_PREFIX-mrdma,subnet=RDMA_NAME_PREFIX-mrdma-sub-4,no-address \
--network-interface=nic-type=MRDMA,network=RDMA_NAME_PREFIX-mrdma,subnet=RDMA_NAME_PREFIX-mrdma-sub-5,no-address \
--network-interface=nic-type=MRDMA,network=RDMA_NAME_PREFIX-mrdma,subnet=RDMA_NAME_PREFIX-mrdma-sub-6,no-address \
--network-interface=nic-type=MRDMA,network=RDMA_NAME_PREFIX-mrdma,subnet=RDMA_NAME_PREFIX-mrdma-sub-7,no-address \
--reservation-affinity=none \
--provisioning-model=FLEX_START \
--request-valid-for-duration=REQUEST_VALID_FOR_DURATION \
--max-run-duration=MAX_RUN_DURATION \
--instance-termination-action=TERMINATION_ACTION \
--maintenance-policy=TERMINATE
Complete the following steps:
-
Replace the following:
INSTANCE_NAME: the name of the VM.MACHINE_TYPE: the machine type to use for the VM. For more information, see GPU machine types.IMAGE_FAMILY: the image family of the OS image that you want to use. For a list of supported operating systems, see Operating system details.IMAGE_PROJECT: the project ID of the OS image.ZONE: the zone in which the machine type that you want to use is available. To specify a compact placement policy, use a zone in the same region as the compact placement policy. For information about regions, see GPU availability by regions and zones.DISK_SIZE: the size of the boot disk in GB.GVNIC_NAME_PREFIX: the name prefix that you specified when creating the standard VPC networks and subnets that use gVNICs.RDMA_NAME_PREFIX: the name prefix that you specified when creating the VPC networks and subnets that use RDMA NICs.REQUEST_VALID_FOR_DURATION: how long the request to create the VM remains valid. You must format the value as the number of days, hours, minutes, or seconds followed byd,h,m, andsrespectively. For example, specify30mfor 30 minutes or1h2m3sfor one hour, two minutes, and three seconds.Based on the zonal requirements for your workload, specify one of the following durations to help increase your chances that your VM creation request succeeds:
- Workloads with strict zonal requirements: if your workload requires you to create the
VM in a specific zone, then specify a duration between 90 seconds (
90s) and two hours (2h). Longer durations give you higher chances of obtaining resources. - Workloads without strict zonal requirements: if the VM can run in any zone within the
region, then specify a duration of zero seconds (
0s). This action specifies that Compute Engine only allocates resources if they are immediately available. If the VM creation request fails because resources are unavailable, then retry the request in a different zone.
- Workloads with strict zonal requirements: if your workload requires you to create the
VM in a specific zone, then specify a duration between 90 seconds (
MAX_RUN_DURATION: how long you want the requested VMs to run. You must format the value as the number of days, hours, minutes, or seconds followed byd,h,m, andsrespectively. The value must be between 10 minutes and seven days.TERMINATION_ACTION: whether Compute Engine stops (STOP) or deletes (DELETE) the VM at the end of its run duration.
-
Optional: To use a compact placement policy, add the following flag:
--resource-policies=POLICY_NAME
Replace the following:
POLICY_NAME: the name of the compact placement policy.
- Run the command.
Reservation-bound
Before running the command, optionally add the flag for a compact placement policy.
gcloud compute instances create INSTANCE_NAME \
--machine-type=MACHINE_TYPE \
--image-family=IMAGE_FAMILY \
--image-project=IMAGE_PROJECT \
--zone=ZONE \
--boot-disk-type=hyperdisk-balanced \
--boot-disk-size=DISK_SIZE \
--scopes=cloud-platform \
--network-interface=nic-type=GVNIC,network=GVNIC_NAME_PREFIX-net-0,subnet=GVNIC_NAME_PREFIX-sub-0 \
--network-interface=nic-type=GVNIC,network=GVNIC_NAME_PREFIX-net-1,subnet=GVNIC_NAME_PREFIX-sub-1,no-address
--network-interface=nic-type=MRDMA,network=RDMA_NAME_PREFIX-mrdma,subnet=RDMA_NAME_PREFIX-mrdma-sub-0,no-address \
--network-interface=nic-type=MRDMA,network=RDMA_NAME_PREFIX-mrdma,subnet=RDMA_NAME_PREFIX-mrdma-sub-1,no-address \
--network-interface=nic-type=MRDMA,network=RDMA_NAME_PREFIX-mrdma,subnet=RDMA_NAME_PREFIX-mrdma-sub-2,no-address \
--network-interface=nic-type=MRDMA,network=RDMA_NAME_PREFIX-mrdma,subnet=RDMA_NAME_PREFIX-mrdma-sub-3,no-address \
--network-interface=nic-type=MRDMA,network=RDMA_NAME_PREFIX-mrdma,subnet=RDMA_NAME_PREFIX-mrdma-sub-4,no-address \
--network-interface=nic-type=MRDMA,network=RDMA_NAME_PREFIX-mrdma,subnet=RDMA_NAME_PREFIX-mrdma-sub-5,no-address \
--network-interface=nic-type=MRDMA,network=RDMA_NAME_PREFIX-mrdma,subnet=RDMA_NAME_PREFIX-mrdma-sub-6,no-address \
--network-interface=nic-type=MRDMA,network=RDMA_NAME_PREFIX-mrdma,subnet=RDMA_NAME_PREFIX-mrdma-sub-7,no-address \
--reservation-affinity=specific \
--reservation=RESERVATION \
--provisioning-model=RESERVATION_BOUND \
--instance-termination-action=TERMINATION_ACTION \
--maintenance-policy=TERMINATE \
--restart-on-failure
Complete the following steps:
-
Replace the following:
INSTANCE_NAME: the name of the VM.MACHINE_TYPE: the machine type to use for the VM. For more information, see GPU machine types.IMAGE_FAMILY: the image family of the OS image that you want to use. For a list of supported operating systems, see Operating system details.IMAGE_PROJECT: the project ID of the OS image.ZONE: the zone in which the machine type that you want to use is available. To specify a compact placement policy, use a zone in the same region as the compact placement policy. For information about regions, see GPU availability by regions and zones.DISK_SIZE: the size of the boot disk in GB.GVNIC_NAME_PREFIX: the name prefix that you specified when creating the standard VPC networks and subnets that use gVNICs.RDMA_NAME_PREFIX: the name prefix that you specified when creating the VPC networks and subnets that use RDMA NICs.-
RESERVATION: either the reservation name or a specific block within a reservation. To get the reservation name or the available blocks, see View reserved capacity. Based on your requirement for instance placement, choose one of the following:To create the instance on any block:
projects/RESERVATION_OWNER_PROJECT_ID/reservations/RESERVATION_NAME
Additionally, to create multiple instances in the same block, apply the same compact placement policy that specifies a block collocation (
maxDistance=2) when creating each instance. Compute Engine then applies the policy to the reservation and creates instances on the same block.To create the instance on a specific block:
projects/RESERVATION_OWNER_PROJECT_ID/reservations/RESERVATION_NAME/reservationBlocks/RESERVATION_BLOCK_NAME
TERMINATION_ACTION: whether Compute Engine stops (STOP) or deletes (DELETE) the VM at the end of the reservation period.
-
Optional: To use a compact placement policy, add the following flag:
--resource-policies=POLICY_NAME
Replace the following:
POLICY_NAME: the name of the compact placement policy.
- Run the command.
Spot
Before running the command, optionally add the flag for a compact placement policy.
gcloud compute instances create INSTANCE_NAME \
--machine-type=MACHINE_TYPE \
--image-family=IMAGE_FAMILY \
--image-project=IMAGE_PROJECT \
--zone=ZONE \
--boot-disk-type=hyperdisk-balanced \
--boot-disk-size=DISK_SIZE \
--scopes=cloud-platform \
--network-interface=nic-type=GVNIC,network=GVNIC_NAME_PREFIX-net-0,subnet=GVNIC_NAME_PREFIX-sub-0 \
--network-interface=nic-type=GVNIC,network=GVNIC_NAME_PREFIX-net-1,subnet=GVNIC_NAME_PREFIX-sub-1,no-address
--network-interface=nic-type=MRDMA,network=RDMA_NAME_PREFIX-mrdma,subnet=RDMA_NAME_PREFIX-mrdma-sub-0,no-address \
--network-interface=nic-type=MRDMA,network=RDMA_NAME_PREFIX-mrdma,subnet=RDMA_NAME_PREFIX-mrdma-sub-1,no-address \
--network-interface=nic-type=MRDMA,network=RDMA_NAME_PREFIX-mrdma,subnet=RDMA_NAME_PREFIX-mrdma-sub-2,no-address \
--network-interface=nic-type=MRDMA,network=RDMA_NAME_PREFIX-mrdma,subnet=RDMA_NAME_PREFIX-mrdma-sub-3,no-address \
--network-interface=nic-type=MRDMA,network=RDMA_NAME_PREFIX-mrdma,subnet=RDMA_NAME_PREFIX-mrdma-sub-4,no-address \
--network-interface=nic-type=MRDMA,network=RDMA_NAME_PREFIX-mrdma,subnet=RDMA_NAME_PREFIX-mrdma-sub-5,no-address \
--network-interface=nic-type=MRDMA,network=RDMA_NAME_PREFIX-mrdma,subnet=RDMA_NAME_PREFIX-mrdma-sub-6,no-address \
--network-interface=nic-type=MRDMA,network=RDMA_NAME_PREFIX-mrdma,subnet=RDMA_NAME_PREFIX-mrdma-sub-7,no-address \
--provisioning-model=SPOT \
--instance-termination-action=TERMINATION_ACTION \
--maintenance-policy=TERMINATE \
--no-restart-on-failure
Complete the following steps:
-
Replace the following:
INSTANCE_NAME: the name of the VM.MACHINE_TYPE: the machine type to use for the VM. For more information, see GPU machine types.IMAGE_FAMILY: the image family of the OS image that you want to use. For a list of supported operating systems, see Operating system details.IMAGE_PROJECT: the project ID of the OS image.ZONE: the zone in which the machine type that you want to use is available. To specify a compact placement policy, use a zone in the same region as the compact placement policy. For information about regions, see GPU availability by regions and zones.DISK_SIZE: the size of the boot disk in GB.GVNIC_NAME_PREFIX: the name prefix that you specified when creating the standard VPC networks and subnets that use gVNICs.RDMA_NAME_PREFIX: the name prefix that you specified when creating the VPC networks and subnets that use RDMA NICs.TERMINATION_ACTION: the action to take when Compute Engine preempts the instance, eitherSTOP(default) orDELETE.
-
Optional: To use a compact placement policy, add the following flag:
--resource-policies=POLICY_NAME
Replace the following:
POLICY_NAME: the name of the compact placement policy.
- Run the command.
After some time, the compute instance creation completes. To verify the instance configuration and to see its status, run the following command:
gcloud compute instances describe INSTANCE_NAME
Configure Spot VMs
If you created a Spot VM, then complete the following steps:
To prepare your Spot VM for a potential preemption, see Manage preemption of Spot VMs.
Optional: Learn about best practices for Spot VMs.
Access the compute instance
After you create the compute instance, the instance starts automatically. To access the instance, do one of the following:
Console
In the Cloud de Confiance console, go to the VM instances page.
Click the name of your compute instance.
In the Remote Access section, click the first drop-down list and choose how you want to access the instance.
Compute Engine propagates your SSH keys and creates your user. For more information, see Connect to Linux VMs.
gcloud
To access the instance using SSH, use the
gcloud compute ssh command:
gcloud compute ssh INSTANCE_NAME --zone ZONE
Compute Engine propagates your SSH keys and creates your user. For more information, see Connect to Linux VMs.
Clean up
To avoid incurring charges to your Cloud de Confiance by S3NS account for the resources used in these quickstarts, delete any compute instances and all attached resources that you created.
Console
In the Cloud de Confiance console, go to the VM instances page.
Select the instances that you want to delete.
Click Delete.
In the dialog, do the following:
Optional: To delete the instances without gracefully shut them down, or end an ongoing graceful shutdown, select the Skip graceful shutdown (if applicable) checkbox.
To confirm, click Delete.
To delete the disks used by the deleted instances, go to the Disks page, then perform the following steps:
Select the disks that you want to delete. The disks you select can't have a value in the In use by column.
Click Delete.
To confirm, click Delete.
gcloud
To delete one or more instances in the same zone, use the
gcloud compute instances delete command.
To force the deletion of the disks attached to one or more instances,
include the --delete-disks flag:
gcloud compute instances delete INSTANCE_NAMES \
--delete-disks=DELETE_DISK_TYPE \
--zone=ZONE
Replace the following:
INSTANCE_NAMES: a list of instance names separated by spaces—for example,instance-01 instance-02 instance-03.ZONE: the zone where the instances are located.DELETE_DISK_TYPE: specify one of the following values:- To delete attached boot and non-boot persistent storage:
all - To delete only attached boot persistent storage:
boot - To delete only non-boot persistent storage:
data
- To delete attached boot and non-boot persistent storage:
Create a custom image based on Advanced Compute Images
You can create a customized image that is based on an Advanced Compute Images image. You can then use the custom image when creating new compute instances for your workloads and applications.
To create a custom image, complete the following tasks:
Configure a storage location for the image. To create, modify, and delete OS images stored in Cloud Storage, you must have been granted the role
roles/compute.storageAdmin.Customize the guest OS as needed for your compute instance.
Stop the compute instance to prevent any writes to the disks. If you can't stop the instance, then complete the steps in Minimize writing data to the persistent disk.
Create a custom image using the boot disk of your compute instance as the source disk. You can do so using the Cloud de Confiance console or the Google Cloud CLI.
Console
In the Cloud de Confiance console, go to the Images page.
Click Create image.
Specify a Name for your image.
Under Source disk, select the name of the boot disk for your compute instance that uses Advanced Compute Images.
If the compute instance isn't stopped, then select Keep instance running to confirm that you want to create the image while the instance is running. You should have previously completed the steps to minimize writes to the boot disk.
In the Based on source disk location (default) drop-down list, specify the location to store the custom image. For example, specify
usto store the image in theusmulti-region, orus-central1to store the custom image in theus-central1region.If you don't make a selection, Compute Engine stores the image in the multi-region closest to the source location for the custom image.
Optional: Specify other properties for your image:
- Family: the image family this new image belongs to.
- Description: a description for your custom image.
- Label: a label to group together resources.
Specify the encryption key. You can choose between a Google Cloud-powered encryption key or a Cloud Key Management Service (Cloud KMS) key. If no encryption key is specified, then images are encrypted using a Google Cloud-powered encryption key.
Click Create to create the image.
gcloud
Use the
gcloud compute images createcommand to create a custom image.The
--forceflag is an optional flag that lets you create the image from a running instance. By default, you cannot create images from running instances. Specify this flag only if you are sure that you want to create the image while the instance is running.gcloud compute images create IMAGE_NAME \ --source-disk=SOURCE_DISK \ --source-disk-zone=ZONE \ [--family=IMAGE_FAMILY] \ [--storage-location=LOCATION] \ [--force]Replace the following:
IMAGE_NAME: a name for the new imageSOURCE_DISK: the disk from which you want to create the imageZONE: the zone where the disk is locatedIMAGE_FAMILY: Optional: a flag that specifies which image family this image belongs toLOCATION: Optional: a flag that lets you designate the region or multi-region where your image is stored. For example, specifyusto store the image in theusmulti-region, orus-central1to store it in theus-central1region. If you don't make a selection, Compute Engine stores the image in the multi-region closest to your image's source location.
For more information about creating custom images, see Create custom images.
Share the image
After creating a custom image, you can share it across projects. If you allow users from another project to use your custom images, then they can access these images by specifying the image project in their request.
Use Advanced Compute Images with instance templates
You can create an instance template that specifies an Advanced Compute Images image and then use the template to do the following:
Create individual compute instances.
Create compute instances in a managed instance group (MIG).
Limitations for creating instance templates
Note the following limitations when creating an instance template:
- Shared VPC on interfaces other than
nic0for instance templates is supported in gcloud CLI and REST, but not in Cloud de Confiance console. - You can't update an existing instance template or change an instance template after it has been created. If an instance template goes out of date, or you need to make changes to the configuration, create a new instance template.
- If you want to specify an image family in an instance template, you can't use the Cloud de Confiance console. You can use the Google Cloud CLI or REST instead.
- You can use an instance template to create compute instances with a Hyperdisk Balanced boot disk that is in a storage pool, but only if the storage pool is in the same zone as the instance.
- You can't use global instance templates to create compute instances with non-boot disks that are in a storage pool.
- To create a regional instance template, the GPU type that you specify in the template must be available in at least one zone in the specified region.
Create an instance template
Most of the instance properties that you can specify in a request to create an individual compute instance can also be specified for an instance template, including any instance metadata, startup scripts, persistent disks, and service accounts. Required information for an instance template includes the machine type, boot disk, and network.
You can create a regional or global instance template that uses Advanced Compute Images by using the Cloud de Confiance console or Google Cloud CLI.
To create an instance template, your user account must have been granted all
the permissions required to call the
instanceTemplates.insert method.
The following sections describe how to create an instance template for use with Managed Instance Groups (MIGs), individual compute instances, or reservations. To create an instance template for use with AI Hypercomputer, follow the instructions at Create an AI-optimized MIG with A4 or A3 Ultra machine type instead.
Create additional resources needed for A3 ultra or A4 instances
Before you create an instance template for instances that use Advanced Compute Images, you must first create the resources that you will specify in the instance template. Complete the tasks listed in Prerequisites to create these resources.
Create an instance template that specifies an Advanced Compute Images image
You can create the instance template by using either the Cloud de Confiance console or gcloud CLI commands.
Console
In the Cloud de Confiance console, go to the Instance templates page.
Click Create instance template.
In the Name field, enter a name for the instance template.
Select the Location as follows:
- To use the instance template across regions, choose Global (default).
- To reduce cross-region dependency, choose Regional and then select the Region where you want to create your instance template.
In the Machine configuration section, do the following:
- Click the GPUs tab.
- In the GPU type list, select the GPU type. For A4 instances, select
NVIDIA B200or for A3 Ultra instances, selectNVIDIA H200 141GB. - In the Number of GPUs list, select 8.
- Optional: Select a different machine type than the default.
In the Boot disk section, click Change, and then do the following:
- In the Operating system list, select Advanced Compute Images.
- In the Version list, select the OS version.
- Optional: Specify additional properties for the boot disk, such as the disk size.
Click Create to create the instance template.
gcloud
To create a regional or global instance template, use the
instance-templates create command.
For a regional instance template, you must use the
--instance-template-region flag to set the region of the template.
When creating an instance template for GPU instances, you must set the
--maintenance-policy flag set to TERMINATE.
Create a regional instance template using the following command.
gcloud compute instance-templates create INSTANCE_TEMPLATE_NAME \ --instance-template-region=REGION \ --accelerator=count=8,type=GPU_TYPE \ --machine-type=MACHINE_TYPE \ --image-project=advanced-compute-images \ --image-family=IMAGE_FAMILY \ --maintenance-policy=TERMINATE
Create a global instance template using the following command:
gcloud compute instance-templates create INSTANCE_TEMPLATE_NAME --accelerator=count=8,type=GPU_TYPE \ --machine-type=MACHINE_TYPE \ --image-project=advanced-compute-images \ --image-family=IMAGE_FAMILY \ --maintenance-policy=TERMINATE
Replace the following:
- INSTANCE_TEMPLATE_NAME: a name for the instance template.
- REGION: for regional instance templates, this is the region to create the template in.
- GPU_TYPE: the type of GPU to use with the compute instances.
When using Advanced Compute Images, you must specify either
nvidia-b200for A4 ornvidia-h200-141gbfor A3 Ultra instances. - MACHINE_TYPE: the machine type of the compute instance. To use Advanced Compute Images, you must specify an A3 Ultra or A4 machine type.
- IMAGE_FAMILY: specify one of the following:
- IMAGE_FAMILY: an image family. This specifies the
most recent OS image version in that family. For example, you might
specify
aci-gpu-u2204-slurm-2511-cuda-130-nvidia-580-amd64. - IMAGE: a specific version of the OS image; for
example,
aci-gpu-u2204-slurm-2511-cuda-130-nvidia-580-amd64-v20260427-1. To specify a specific version of the OS image instead of an image family, you must use the--imageflag instead of the--image-familyflag.
- IMAGE_FAMILY: an image family. This specifies the
most recent OS image version in that family. For example, you might
specify
You can add up to 15 secondary non-boot disks. Specify the --create-disk
flag for each secondary disk you create.
- To create secondary disks from a public or custom image, specify the
imageandimage-projectproperties for each disk in the--create-diskflag. - To create a blank disk, don't include the
imageorimage-projectproperties - Optionally, include properties for the disk
sizeandtype.
For a list of all available subcommands and flags, see the
instance-templates reference.
What's next
* Review Basic scenarios for creating managed instance groups (MIGs). * Learn how to check the status of an instance to see when it is ready to use. * Learn how to connect to your instance.