instance_templates
Creates, updates, deletes, gets or lists an instance_templates resource.
Overview
| Name | instance_templates |
| Type | Resource |
| Id | google.compute.instance_templates |
Fields
The following fields are returned by SELECT queries:
- get
- list
- aggregated_list
| Name | Datatype | Description |
|---|---|---|
id | string (uint64) | Output only. [Output Only] A unique identifier for this instance template. The server defines this identifier. |
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 withRFC1035. 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. (pattern: [a-z](?:[-a-z0-9]{0,61}[a-z0-9])?) |
creationTimestamp | string | Output only. [Output Only] The creation timestamp for this instance template inRFC3339 text format. |
description | string | An optional description of this resource. Provide this property when you create the resource. |
kind | string | Output only. [Output Only] The resource type, which is alwayscompute#instanceTemplate for instance templates. (default: compute#instanceTemplate) |
properties | object | The instance properties for this instance template. (id: InstanceProperties) |
region | string | Output only. [Output Only] URL of the region where the instance template resides. Only applicable for regional resources. |
selfLink | string | Output only. [Output Only] The URL for this instance template. The server defines this URL. |
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: - https://www.googleapis.com/compute/v1/projects/project/zones/zone/instances/instance - projects/project/zones/zone/instances/instance |
sourceInstanceParams | object | The source instance params to use to create this instance template. (id: SourceInstanceParams) |
| Name | Datatype | Description |
|---|---|---|
id | string | [Output Only] Unique identifier for the resource; defined by the server. |
items | array | A list of InstanceTemplate resources. |
kind | string | Output only. [Output Only] The resource type, which is alwayscompute#instanceTemplatesListResponse for instance template lists. (default: compute#instanceTemplateList) |
nextPageToken | string | [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger thanmaxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. |
selfLink | string | Output only. [Output Only] Server-defined URL for this resource. |
warning | object | [Output Only] Informational warning message. |
| Name | Datatype | Description |
|---|---|---|
id | string (uint64) | Output only. [Output Only] A unique identifier for this instance template. The server defines this identifier. |
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 withRFC1035. 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. (pattern: [a-z](?:[-a-z0-9]{0,61}[a-z0-9])?) |
creationTimestamp | string | Output only. [Output Only] The creation timestamp for this instance template inRFC3339 text format. |
description | string | An optional description of this resource. Provide this property when you create the resource. |
kind | string | Output only. [Output Only] The resource type, which is alwayscompute#instanceTemplate for instance templates. (default: compute#instanceTemplate) |
properties | object | The instance properties for this instance template. (id: InstanceProperties) |
region | string | Output only. [Output Only] URL of the region where the instance template resides. Only applicable for regional resources. |
selfLink | string | Output only. [Output Only] The URL for this instance template. The server defines this URL. |
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: - https://www.googleapis.com/compute/v1/projects/project/zones/zone/instances/instance - projects/project/zones/zone/instances/instance |
sourceInstanceParams | object | The source instance params to use to create this instance template. (id: SourceInstanceParams) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | project, region, instanceTemplate | Returns the specified instance template. | |
list | select | project, region | returnPartialSuccess, filter, maxResults, pageToken, orderBy | Retrieves a list of instance templates that are contained within the specified project and region. |
aggregated_list | select | project | includeAllScopes, orderBy, maxResults, pageToken, filter, serviceProjectNumber, returnPartialSuccess | Retrieves the list of all InstanceTemplates resources, regional and global, available to the specified project. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true. |
insert | insert | project, region | requestId | Creates an instance template in the specified project and region using the global instance template whose URL is included in the request. |
delete | delete | project, region, instanceTemplate | requestId | Deletes the specified instance template. Deleting an instance template is permanent and cannot be undone. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
instanceTemplate | string | |
project | string | |
region | string | |
filter | string | |
includeAllScopes | boolean | |
maxResults | integer (uint32) | |
orderBy | string | |
pageToken | string | |
requestId | string | |
returnPartialSuccess | boolean | |
serviceProjectNumber | string (int64) |
SELECT examples
- get
- list
- aggregated_list
Returns the specified instance template.
SELECT
id,
name,
creationTimestamp,
description,
kind,
properties,
region,
selfLink,
sourceInstance,
sourceInstanceParams
FROM google.compute.instance_templates
WHERE project = '{{ project }}' -- required
AND region = '{{ region }}' -- required
AND instanceTemplate = '{{ instanceTemplate }}' -- required
;
Retrieves a list of instance templates that are contained within the
specified project and region.
SELECT
id,
items,
kind,
nextPageToken,
selfLink,
warning
FROM google.compute.instance_templates
WHERE project = '{{ project }}' -- required
AND region = '{{ region }}' -- required
AND returnPartialSuccess = '{{ returnPartialSuccess }}'
AND filter = '{{ filter }}'
AND maxResults = '{{ maxResults }}'
AND pageToken = '{{ pageToken }}'
AND orderBy = '{{ orderBy }}'
;
Retrieves the list of all InstanceTemplates resources, regional and global,
available to the specified project.
To prevent failure, Google recommends that you set thereturnPartialSuccess parameter to true.
SELECT
id,
name,
creationTimestamp,
description,
kind,
properties,
region,
selfLink,
sourceInstance,
sourceInstanceParams
FROM google.compute.instance_templates
WHERE project = '{{ project }}' -- required
AND includeAllScopes = '{{ includeAllScopes }}'
AND orderBy = '{{ orderBy }}'
AND maxResults = '{{ maxResults }}'
AND pageToken = '{{ pageToken }}'
AND filter = '{{ filter }}'
AND serviceProjectNumber = '{{ serviceProjectNumber }}'
AND returnPartialSuccess = '{{ returnPartialSuccess }}'
;
INSERT examples
- insert
- Manifest
Creates an instance template in the specified project and region using the
global instance template whose URL is included in the request.
INSERT INTO google.compute.instance_templates (
data__properties,
data__description,
data__sourceInstanceParams,
data__name,
data__sourceInstance,
project,
region,
requestId
)
SELECT
'{{ properties }}',
'{{ description }}',
'{{ sourceInstanceParams }}',
'{{ name }}',
'{{ sourceInstance }}',
'{{ project }}',
'{{ region }}',
'{{ requestId }}'
RETURNING
id,
name,
clientOperationId,
creationTimestamp,
description,
endTime,
error,
getVersionOperationMetadata,
httpErrorMessage,
httpErrorStatusCode,
insertTime,
instancesBulkInsertOperationMetadata,
kind,
operationGroupId,
operationType,
progress,
region,
selfLink,
setCommonInstanceMetadataOperationMetadata,
startTime,
status,
statusMessage,
targetId,
targetLink,
user,
warnings,
zone
;
# Description fields are for documentation purposes
- name: instance_templates
props:
- name: project
value: "{{ project }}"
description: Required parameter for the instance_templates resource.
- name: region
value: "{{ region }}"
description: Required parameter for the instance_templates resource.
- name: properties
description: |
The instance properties for this instance template.
value:
scheduling:
onHostMaintenance: "{{ onHostMaintenance }}"
hostErrorTimeoutSeconds: {{ hostErrorTimeoutSeconds }}
provisioningModel: "{{ provisioningModel }}"
availabilityDomain: {{ availabilityDomain }}
onInstanceStopAction:
discardLocalSsd: {{ discardLocalSsd }}
nodeAffinities:
- values: "{{ values }}"
key: "{{ key }}"
operator: "{{ operator }}"
maxRunDuration:
nanos: {{ nanos }}
seconds: "{{ seconds }}"
instanceTerminationAction: "{{ instanceTerminationAction }}"
preemptionNoticeDuration:
nanos: {{ nanos }}
seconds: "{{ seconds }}"
preemptible: {{ preemptible }}
skipGuestOsShutdown: {{ skipGuestOsShutdown }}
terminationTime: "{{ terminationTime }}"
localSsdRecoveryTimeout:
nanos: {{ nanos }}
seconds: "{{ seconds }}"
minNodeCpus: {{ minNodeCpus }}
gracefulShutdown:
enabled: {{ enabled }}
maxDuration:
nanos: {{ nanos }}
seconds: "{{ seconds }}"
automaticRestart: {{ automaticRestart }}
locationHint: "{{ locationHint }}"
guestAccelerators:
- acceleratorType: "{{ acceleratorType }}"
acceleratorCount: {{ acceleratorCount }}
privateIpv6GoogleAccess: "{{ privateIpv6GoogleAccess }}"
reservationAffinity:
consumeReservationType: "{{ consumeReservationType }}"
key: "{{ key }}"
values:
- "{{ values }}"
machineType: "{{ machineType }}"
shieldedInstanceConfig:
enableSecureBoot: {{ enableSecureBoot }}
enableIntegrityMonitoring: {{ enableIntegrityMonitoring }}
enableVtpm: {{ enableVtpm }}
networkPerformanceConfig:
totalEgressBandwidthTier: "{{ totalEgressBandwidthTier }}"
resourcePolicies:
- "{{ resourcePolicies }}"
canIpForward: {{ canIpForward }}
localSsdEncryptionMode: "{{ localSsdEncryptionMode }}"
tags:
items:
- "{{ items }}"
fingerprint: "{{ fingerprint }}"
minCpuPlatform: "{{ minCpuPlatform }}"
confidentialInstanceConfig:
enableConfidentialCompute: {{ enableConfidentialCompute }}
confidentialInstanceType: "{{ confidentialInstanceType }}"
workloadIdentityConfig:
identityCertificateEnabled: {{ identityCertificateEnabled }}
identity: "{{ identity }}"
networkInterfaces:
- ipv6Address: "{{ ipv6Address }}"
parentNicName: "{{ parentNicName }}"
fingerprint: "{{ fingerprint }}"
igmpQuery: "{{ igmpQuery }}"
serviceClassId: "{{ serviceClassId }}"
subnetwork: "{{ subnetwork }}"
network: "{{ network }}"
stackType: "{{ stackType }}"
ipv6AccessType: "{{ ipv6AccessType }}"
accessConfigs: "{{ accessConfigs }}"
networkAttachment: "{{ networkAttachment }}"
queueCount: {{ queueCount }}
name: "{{ name }}"
kind: "{{ kind }}"
networkIP: "{{ networkIP }}"
vlan: {{ vlan }}
internalIpv6PrefixLength: {{ internalIpv6PrefixLength }}
nicType: "{{ nicType }}"
aliasIpRanges: "{{ aliasIpRanges }}"
ipv6AccessConfigs: "{{ ipv6AccessConfigs }}"
aliasIpv6Ranges: "{{ aliasIpv6Ranges }}"
enableVpcScopedDns: {{ enableVpcScopedDns }}
serviceAccounts:
- scopes: "{{ scopes }}"
email: "{{ email }}"
keyRevocationActionType: "{{ keyRevocationActionType }}"
metadata:
fingerprint: "{{ fingerprint }}"
items:
- key: "{{ key }}"
value: "{{ value }}"
kind: "{{ kind }}"
description: "{{ description }}"
disks:
- diskSizeGb: "{{ diskSizeGb }}"
boot: {{ boot }}
architecture: "{{ architecture }}"
deviceName: "{{ deviceName }}"
savedState: "{{ savedState }}"
diskEncryptionKey:
rawKey: "{{ rawKey }}"
kmsKeyServiceAccount: "{{ kmsKeyServiceAccount }}"
rsaEncryptedKey: "{{ rsaEncryptedKey }}"
kmsKeyName: "{{ kmsKeyName }}"
sha256: "{{ sha256 }}"
interface: "{{ interface }}"
mode: "{{ mode }}"
source: "{{ source }}"
kind: "{{ kind }}"
licenses: "{{ licenses }}"
shieldedInstanceInitialState:
pk:
content: "{{ content }}"
fileType: "{{ fileType }}"
keks:
- content: "{{ content }}"
fileType: "{{ fileType }}"
dbs:
- content: "{{ content }}"
fileType: "{{ fileType }}"
dbxs:
- content: "{{ content }}"
fileType: "{{ fileType }}"
type: "{{ type }}"
index: {{ index }}
autoDelete: {{ autoDelete }}
guestOsFeatures: "{{ guestOsFeatures }}"
forceAttach: {{ forceAttach }}
initializeParams:
resourcePolicies:
- "{{ resourcePolicies }}"
storagePool: "{{ storagePool }}"
replicaZones:
- "{{ replicaZones }}"
diskSizeGb: "{{ diskSizeGb }}"
architecture: "{{ architecture }}"
sourceImage: "{{ sourceImage }}"
enableConfidentialCompute: {{ enableConfidentialCompute }}
sourceImageEncryptionKey:
rawKey: "{{ rawKey }}"
kmsKeyServiceAccount: "{{ kmsKeyServiceAccount }}"
rsaEncryptedKey: "{{ rsaEncryptedKey }}"
kmsKeyName: "{{ kmsKeyName }}"
sha256: "{{ sha256 }}"
description: "{{ description }}"
provisionedIops: "{{ provisionedIops }}"
labels: "{{ labels }}"
provisionedThroughput: "{{ provisionedThroughput }}"
diskName: "{{ diskName }}"
sourceSnapshotEncryptionKey:
rawKey: "{{ rawKey }}"
kmsKeyServiceAccount: "{{ kmsKeyServiceAccount }}"
rsaEncryptedKey: "{{ rsaEncryptedKey }}"
kmsKeyName: "{{ kmsKeyName }}"
sha256: "{{ sha256 }}"
resourceManagerTags: "{{ resourceManagerTags }}"
diskType: "{{ diskType }}"
licenses:
- "{{ licenses }}"
onUpdateAction: "{{ onUpdateAction }}"
sourceSnapshot: "{{ sourceSnapshot }}"
advancedMachineFeatures:
enableUefiNetworking: {{ enableUefiNetworking }}
performanceMonitoringUnit: "{{ performanceMonitoringUnit }}"
threadsPerCore: {{ threadsPerCore }}
visibleCoreCount: {{ visibleCoreCount }}
enableNestedVirtualization: {{ enableNestedVirtualization }}
turboMode: "{{ turboMode }}"
labels: "{{ labels }}"
resourceManagerTags: "{{ resourceManagerTags }}"
- name: description
value: "{{ description }}"
description: |
An optional description of this resource. Provide this property when you
create the resource.
- name: sourceInstanceParams
description: |
The source instance params to use to create this instance template.
value:
diskConfigs:
- instantiateFrom: "{{ instantiateFrom }}"
deviceName: "{{ deviceName }}"
autoDelete: {{ autoDelete }}
customImage: "{{ customImage }}"
- name: name
value: "{{ name }}"
description: |
Name of the resource; provided by the client when the resource is created.
The name must be 1-63 characters long, and comply withRFC1035.
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.
- name: sourceInstance
value: "{{ sourceInstance }}"
description: |
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:
- https://www.googleapis.com/compute/v1/projects/project/zones/zone/instances/instance
- projects/project/zones/zone/instances/instance
- name: requestId
value: "{{ requestId }}"
DELETE examples
- delete
Deletes the specified instance template. Deleting an instance template is
permanent and cannot be undone.
DELETE FROM google.compute.instance_templates
WHERE project = '{{ project }}' --required
AND region = '{{ region }}' --required
AND instanceTemplate = '{{ instanceTemplate }}' --required
AND requestId = '{{ requestId }}'
;