REST Resource: instanceTemplates

Resource: InstanceTemplate

Represents an Instance Template resource.

Google Compute Engine has two Instance Template resources:

You can reuse a global instance template in different regions whereas you can use a regional instance template in a specified region only. If you want to reduce cross-region dependency or achieve data residency, use a regional instance template.

To create VMs, managed instance groups, and reservations, you can use either global or regional instance templates.

For more information, read Instance Templates.

JSON representation
{
  "kind": string,
  "id": string,
  "creationTimestamp": string,
  "name": string,
  "description": string,
  "properties": {
    object (InstanceProperties)
  },
  "selfLink": string,
  "sourceInstance": string,
  "sourceInstanceParams": {
    object (SourceInstanceParams)
  },
  "region": string
}
Fields
kind

string

[Output Only] The resource type, which is always

compute#instanceTemplate

for instance templates.

id

string (uint64 format)

[Output Only] A unique identifier for this instance template. The server defines this identifier.

creationTimestamp

string

[Output Only] The creation timestamp for this instance template in RFC3339 text format.

name

string

Name of the resource; provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.

description

string

An optional description of this resource. Provide this property when you create the resource.

properties

object (InstanceProperties)

The instance properties for this instance template.

sourceInstance

string

The source instance used to create the template. You can provide this as a partial or full URL to the resource. For example, the following are valid values:

sourceInstanceParams

object (SourceInstanceParams)

The source instance params to use to create this instance template.

region

string

[Output Only] URL of the region where the instance template resides. Only applicable for regional resources.

SourceInstanceParams

A specification of the parameters to use when creating the instance template from a source instance.

JSON representation
{
  "diskConfigs": [
    {
      object (DiskInstantiationConfig)
    }
  ]
}
Fields
diskConfigs[]

object (DiskInstantiationConfig)

Attached disks configuration. If not provided, defaults are applied: For boot disk and any other R/W disks, the source images for each disk will be used. For read-only disks, they will be attached in read-only mode. Local SSD disks will be created as blank volumes.

DiskInstantiationConfig

A specification of the desired way to instantiate a disk in the instance template when its created from a source instance.

JSON representation
{
  "deviceName": string,
  "instantiateFrom": enum (DiskInstantiationOptions),
  "autoDelete": boolean,
  "customImage": string
}
Fields
deviceName

string

Specifies the device name of the disk to which the configurations apply to.

instantiateFrom

enum (DiskInstantiationOptions)

Specifies whether to include the disk and what image to use. Possible values are:

  • source-image

    : to use the same image that was used to create the source instance's corresponding disk. Applicable to the boot disk and additional read-write disks.

  • source-image-family

    : to use the same image family that was used to create the source instance's corresponding disk. Applicable to the boot disk and additional read-write disks.

  • custom-image

    : to use a user-provided image url for disk creation. Applicable to the boot disk and additional read-write disks.

  • attach-read-only

    : to attach a read-only disk. Applicable to read-only disks.

  • do-not-include

    : to exclude a disk from the template. Applicable to additional read-write disks, local SSDs, and read-only disks.

autoDelete

boolean

Specifies whether the disk will be auto-deleted when the instance is deleted (but not when the disk is detached from the instance).

customImage

string

The custom source image to be used to restore this disk when instantiating this instance template.

DiskInstantiationOptions

Enums
DEFAULT Use the default instantiation option for the corresponding type of disk. For boot disk and any other R/W disks, new custom images will be created from each disk. For read-only disks, they will be attached in read-only mode. Local SSD disks will be created as blank volumes.
CUSTOM_IMAGE Use the custom image specified in the customImage field. Applicable to: boot disk, additional read-write disks.
SOURCE_IMAGE Use the same source image used for creation of the source instance's corresponding disk. The request will fail if the source VM's disk was created from a snapshot. Applicable to: boot disk, additional read-write disks.
SOURCE_IMAGE_FAMILY Use the same source image family used for creation of the source instance's corresponding disk. The request will fail if the source image of the source disk does not belong to any image family. Applicable to: boot disk, additional read-write disks.
BLANK Create a blank disk. The disk will be created unformatted. Applicable to: additional read-write disks, local SSDs.
ATTACH_READ_ONLY Attach the existing disk in read-only mode. The request will fail if the disk was attached in read-write mode on the source instance. Applicable to: read-only disks.
DO_NOT_INCLUDE Do not include the disk in the instance template. Applicable to: additional read-write disks, local SSDs, read-only disks.

Methods

aggregatedList

The method compute.v1.InstanceTemplatesService.AggregatedList is not available in this (s3nsapis.fr) universe.

delete

The method compute.v1.InstanceTemplatesService.Delete is not available in this (s3nsapis.fr) universe.

get

The method compute.v1.InstanceTemplatesService.Get is not available in this (s3nsapis.fr) universe.

getIamPolicy

The method compute.v1.InstanceTemplatesService.GetPolicy is not available in this (s3nsapis.fr) universe.

insert

The method compute.v1.InstanceTemplatesService.Insert is not available in this (s3nsapis.fr) universe.

list

The method compute.v1.InstanceTemplatesService.List is not available in this (s3nsapis.fr) universe.

setIamPolicy

The method compute.v1.InstanceTemplatesService.SetPolicy is not available in this (s3nsapis.fr) universe.

testIamPermissions

The method compute.v1.InstanceTemplatesService.TestPermissions is not available in this (s3nsapis.fr) universe.