Skip to main content

instance_templates

Creates, updates, deletes, gets or lists an instance_templates resource.

Overview

Nameinstance_templates
TypeResource
Idgoogle.compute.instance_templates

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
idstring (uint64)[Output Only] A unique identifier for this instance template. The server defines this identifier.
namestringName 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. (pattern: a-z?)
creationTimestampstring[Output Only] The creation timestamp for this instance template in RFC3339 text format.
descriptionstringAn optional description of this resource. Provide this property when you create the resource.
kindstring[Output Only] The resource type, which is always compute#instanceTemplate for instance templates. (default: compute#instanceTemplate)
propertiesobjectThe instance properties for this instance template. (id: InstanceProperties)
regionstring[Output Only] URL of the region where the instance template resides. Only applicable for regional resources.
selfLinkstring[Output Only] The URL for this instance template. The server defines this URL.
sourceInstancestringThe 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
sourceInstanceParamsobjectThe source instance params to use to create this instance template. (id: SourceInstanceParams)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectproject, region, instanceTemplateReturns the specified instance template.
listselectproject, regionfilter, maxResults, orderBy, pageToken, returnPartialSuccessRetrieves a list of instance templates that are contained within the specified project and region.
insertinsertproject, regionrequestIdCreates an instance template in the specified project and region using the global instance template whose URL is included in the request.
deletedeleteproject, region, instanceTemplaterequestIdDeletes 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.

NameDatatypeDescription
instanceTemplatestring
projectstring
regionstring
filterstring
maxResultsinteger (uint32)
orderBystring
pageTokenstring
requestIdstring
returnPartialSuccessboolean

SELECT examples

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;

INSERT examples

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__kind,
data__id,
data__creationTimestamp,
data__name,
data__description,
data__properties,
data__selfLink,
data__sourceInstance,
data__sourceInstanceParams,
data__region,
project,
region,
requestId
)
SELECT
'{{ kind }}',
'{{ id }}',
'{{ creationTimestamp }}',
'{{ name }}',
'{{ description }}',
'{{ properties }}',
'{{ selfLink }}',
'{{ sourceInstance }}',
'{{ sourceInstanceParams }}',
'{{ region }}',
'{{ project }}',
'{{ region }}',
'{{ requestId }}'
RETURNING
id,
name,
clientOperationId,
creationTimestamp,
description,
endTime,
error,
httpErrorMessage,
httpErrorStatusCode,
insertTime,
instancesBulkInsertOperationMetadata,
kind,
operationGroupId,
operationType,
progress,
region,
selfLink,
setCommonInstanceMetadataOperationMetadata,
startTime,
status,
statusMessage,
targetId,
targetLink,
user,
warnings,
zone
;

DELETE examples

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 }}';