v1

latestSwagger 2.02026-08-04232286653.5 KB
Instance Templates

Creates an instance template in the project and returns the created instance template.

post/projects/{project_id}/compute/instance-templates

Path parameters

project_idstring required

Request body

custom_image_namestring

Custom image to use for all VMs created from this instance template. Only one of Image or CustomImage should be supplied at once.

ib_partition_idstring

Deprecated: Use transport_partition_id instead.

image_namestring

OS Image to use for all VMs created from this instance template.

locationstring

Location to use for all VMs created from this instance template. If provided, all location-specific resources must also be provided.

maintenance_policystring

Host maintenance policy controlling how VMs created from this instance template behave during host maintenance.

nvlink_domain_idstring

NVLink domain to assign to all VMs created from this instance template.

placement_policystring

Placement policy controlling how VMs created from this instance template are distributed across hosts: spread or unspecified.

public_ip_address_typestring

Public IP address type to use for all VMs created from this instance template. Must either be "static" or "dynamic".

reservation_idstring

Reservation to use for all VMs created from this instance template.

shutdown_scriptstring

Shutdown script to use for all VMs created from this instance template.

ssh_public_keystring required

SSH public key to use for all VMs created from this instance template.

startup_scriptstring

Startup script to use for all VMs created from this instance template.

subnet_idstring

Subnet to use for all VMs created from this instance template. This is location-specific and must be provided if location is provided.

template_namestring required

Name of the instance template. (This is not the name of the VMs created from this instance template.)

transport_partition_idstring

IB or RoCE partition to use for all VMs created from this instance template. Should only be provided for transport-enabled VM types. This is location-specific and must be provided if location is provided.

typestring required

Product name of the VM type we want to create from this instance template.

Example request

{
  "custom_image_name": "ubuntu:20.04",
  "disks": [
    {
      "size": "10GiB",
      "type": "persistent-ssd"
    }
  ],
  "image_name": "ubuntu:20.04",
  "location": "us-northcentral1-a",
  "maintenance_policy": "manual,stop-vm,unspecified",
  "nvlink_domain_id": "550e8400-e29b-41d4-a716-446655440000",
  "placement_policy": "spread",
  "public_ip_address_type": "static",
  "reservation_id": "804bf3a2-81f2-4d78-9a9e-dc6a55ed33d8",
  "shutdown_script": "\"#!/bin/bash\\necho 'goodbye'\"",
  "ssh_public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCspdG97nTS/h4PEPq2QD2RYVK1jxFXLFZuSDMI8Rtxpucl6LDZLOghEYoj13lxKQnGtcsM3Iu68lh+4YgZe7CbI6cc/TxPbeAX2HJTqDh0J7+GAlLBHK9tsepC0QlhIDiazJptOPDZ3cesCBXdxSnzEbhDaqgYOfl393cp1fCeOKRIDWEP3H9CM25dCbWF66sTDziLsojJ9dMnxhgKm9/JkZc5gYncLT/2Ey+VWfV9Fs65mGUrBbQOn3c8S/nEk6WRcYn4PFOnIp0Mz+Chb50iCJrW677pllLnkTGSU+4c0H9J5z4HDG0I+91RoiQ0QsayFTYO1JtSn+THLuq98V+D",
  "startup_script": "\"#!/bin/bash\\necho 'hello'\"",
  "subnet_id": "09ae8411-0fbb-411c-898c-2b8f19622ae1",
  "template_name": "my-instance-template",
  "transport_partition_id": "09ae8411-0fbb-411c-898c-2b8f19622ae1",
  "type": "a100.2x",
  "virtualization_features": {
    "nested_virtualization": true
  }
}

Response

created_atstring required

Creation timestamp of the instance template, in RFC3339 format.

custom_image_namestring

Custom image to use for all VMs created from this instance template.

ib_partition_idstring required
idstring required

ID of the instance template.

image_namestring required

OS Image to use for all VMs created from this instance template.

locationstring required

Location to use for all VMs created from this instance template. May be empty if we do not want to bind this template to a location.

maintenance_policy'manual' | 'stop-vm' | 'unspecified' required

Host maintenance policy controlling how VMs created from this instance template behave during host maintenance: manual, stop-vm, or unspecified.

namestring required

Name of the instance template. (This is not the name of the VMs created from this instance template.)

nvlink_domain_idstring

NVLink domain assigned to all VMs created from this instance template.

placement_policy'spread' | 'unspecified' required

Placement policy controlling how VMs created from this instance template are distributed across hosts: spread or unspecified.

project_idstring required

ID of the project this instance template belongs to.

public_ip_address_typestring required

Public IP address type to use for all VMs created from this instance template. Must either be "static" or "dynamic".

reservation_idstring

Reservation used for all VMs created from this instance template.

shutdown_scriptstring required

Shutdown script to use for all VMs created from this instance template.

ssh_public_keystring required

SSH public key to use for all VMs created from this instance template.

startup_scriptstring required

Startup script to use for all VMs created from this instance template.

subnet_idstring required

SubnetID to use for all VMs created from this instance template. Only used if template has a location.

transport_partition_idstring required

IB or RoCE partition to use for all VMs created from this instance template. Only used for transport-enabled VM types. Empty if template has no location.

typestring required

Product name of the VM type we want to create from this instance template.

Example response

{
  "created_at": "2024-01-01T00:00:00Z",
  "custom_image_name": "ubuntu:20.04",
  "disks": [
    {
      "size": "10GiB",
      "type": "persistent-ssd"
    }
  ],
  "id": "ab4a6b00-aa5f-408e-a9fb-ac6de5eb45ab",
  "image_name": "ubuntu:20.04",
  "location": "us-northcentral1-a",
  "name": "my-instance-template",
  "nvlink_domain_id": "550e8400-e29b-41d4-a716-446655440000",
  "project_id": "09ae8411-0fbb-411c-898c-2b8f19622ae1",
  "public_ip_address_type": "static",
  "reservation_id": "804bf3a2-81f2-4d78-9a9e-dc6a55ed33d8",
  "shutdown_script": "#!/bin/bash\\necho 'goodbye'",
  "ssh_public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCspdG97nTS/h4PEPq2QD2RYVK1jxFXLFZuSDMI8Rtxpucl6LDZLOghEYoj13lxKQnGtcsM3Iu68lh+4YgZe7CbI6cc/TxPbeAX2HJTqDh0J7+GAlLBHK9tsepC0QlhIDiazJptOPDZ3cesCBXdxSnzEbhDaqgYOfl393cp1fCeOKRIDWEP3H9CM25dCbWF66sTDziLsojJ9dMnxhgKm9/JkZc5gYncLT/2Ey+VWfV9Fs65mGUrBbQOn3c8S/nEk6WRcYn4PFOnIp0Mz+Chb50iCJrW677pllLnkTGSU+4c0H9J5z4HDG0I+91RoiQ0QsayFTYO1JtSn+THLuq98V+D",
  "startup_script": "#!/bin/bash\\necho 'hello'",
  "subnet_id": "09ae8411-0fbb-411c-898c-2b8f19622ae1",
  "transport_partition_id": "09ae8411-0fbb-411c-898c-2b8f19622ae1",
  "type": "a100.2x",
  "virtualization_features": {
    "nested_virtualization": true
  }
}