instances
Creates, updates, deletes, gets or lists an instances resource.
Overview
| Name | instances |
| Type | Resource |
| Id | google.compute.instances |
Fields
The following fields are returned by SELECT queries:
- get
- list
- aggregated_list
| Name | Datatype | Description |
|---|---|---|
id | string (uint64) | Output only. [Output Only] The unique identifier for the resource. This identifier is defined by the server. |
name | string | The name of the resource, provided by the client when initially creating the resource. The resource 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])?) |
advancedMachineFeatures | object | Controls for advanced machine-related behavior features. (id: AdvancedMachineFeatures) |
canIpForward | boolean | Allows this instance to send and receive packets with non-matching destination or source IPs. This is required if you plan to use this instance to forward routes. For more information, seeEnabling IP Forwarding. |
confidentialInstanceConfig | object | A set of Confidential Instance options. (id: ConfidentialInstanceConfig) |
cpuPlatform | string | Output only. [Output Only] The CPU platform used by this instance. |
creationTimestamp | string | Output only. [Output Only] Creation timestamp inRFC3339 text format. |
deletionProtection | boolean | Whether the resource should be protected against deletion. |
description | string | An optional description of this resource. Provide this property when you create the resource. |
disks | array | Array of disks associated with this instance. Persistent disks must be created before you can assign them. |
displayDevice | object | Enables display device for the instance. (id: DisplayDevice) |
fingerprint | string (byte) | Specifies a fingerprint for this resource, which is essentially a hash of the instance's contents and used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update the instance. You must always provide an up-to-date fingerprint hash in order to update the instance. To see the latest fingerprint, make get() request to the instance. |
guestAccelerators | array | A list of the type and count of accelerator cards attached to the instance. |
hostname | string | Specifies the hostname of the instance. The specified hostname must be RFC1035 compliant. If hostname is not specified, the default hostname is [INSTANCE_NAME].c.[PROJECT_ID].internal when using the global DNS, and [INSTANCE_NAME].[ZONE].c.[PROJECT_ID].internal when using zonal DNS. |
instanceEncryptionKey | object | Encrypts suspended data for an instance with acustomer-managed encryption key. If you are creating a new instance, this field will encrypt the local SSD and in-memory contents of the instance during the suspend operation. If you do not provide an encryption key when creating the instance, then the local SSD and in-memory contents will be encrypted using an automatically generated key during the suspend operation. (id: CustomerEncryptionKey) |
keyRevocationActionType | string | KeyRevocationActionType of the instance. Supported options are "STOP" and "NONE". The default value is "NONE" if it is not specified. (KEY_REVOCATION_ACTION_TYPE_UNSPECIFIED, NONE, STOP) |
kind | string | Output only. [Output Only] Type of the resource. Always compute#instance for instances. (default: compute#instance) |
labelFingerprint | string (byte) | A fingerprint for this request, which is essentially a hash of the label's contents and used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash in order to update or change labels. To see the latest fingerprint, make get() request to the instance. |
labels | object | Labels to apply to this instance. These can be later modified by the setLabels method. |
lastStartTimestamp | string | Output only. [Output Only] Last start timestamp inRFC3339 text format. |
lastStopTimestamp | string | Output only. [Output Only] Last stop timestamp inRFC3339 text format. |
lastSuspendedTimestamp | string | Output only. [Output Only] Last suspended timestamp inRFC3339 text format. |
localSsdEncryptionMode | string | Specifies which method should be used for encrypting the Local SSDs attached to the VM. (EPHEMERAL_KEY_ENCRYPTION, LOCAL_SSD_ENCRYPTION_MODE_UNSPECIFIED, STANDARD_ENCRYPTION) |
machineType | string | Full or partial URL of the machine type resource to use for this instance, in the format:zones/zone/machineTypes/machine-type. This is provided by the client when the instance is created. For example, the following is a valid partial url to a predefined machine type: zones/us-central1-f/machineTypes/n1-standard-1 To create acustom machine type, provide a URL to a machine type in the following format, where CPUS is 1 or an even number up to 32 (2, 4, 6, ... 24, etc), and MEMORY is the total memory for this instance. Memory must be a multiple of 256 MB and must be supplied in MB (e.g. 5 GB of memory is 5120 MB): zones/zone/machineTypes/custom-CPUS-MEMORY For example: zones/us-central1-f/machineTypes/custom-4-5120 For a full list of restrictions, read theSpecifications for custom machine types. |
metadata | object | The metadata key/value pairs assigned to this instance. This includes metadata keys that were explicitly defined for the instance. (id: Metadata) |
minCpuPlatform | string | Specifies aminimum CPU platform for the VM instance. Applicable values are the friendly names of CPU platforms, such as minCpuPlatform: "Intel Haswell" or minCpuPlatform: "Intel Sandy Bridge". |
networkInterfaces | array | An array of network configurations for this instance. These specify how interfaces are configured to interact with other network services, such as connecting to the internet. Multiple interfaces are supported per instance. |
networkPerformanceConfig | object | (id: NetworkPerformanceConfig) |
params | object | Input only. [Input Only] Additional params passed with the request, but not persisted as part of resource payload. (id: InstanceParams) |
privateIpv6GoogleAccess | string | The private IPv6 google access type for the VM. If not specified, use INHERIT_FROM_SUBNETWORK as default. (ENABLE_BIDIRECTIONAL_ACCESS_TO_GOOGLE, ENABLE_OUTBOUND_VM_ACCESS_TO_GOOGLE, INHERIT_FROM_SUBNETWORK) |
reservationAffinity | object | Specifies the reservations that this instance can consume from. (id: ReservationAffinity) |
resourcePolicies | array | Resource policies applied to this instance. |
resourceStatus | object | Output only. [Output Only] Specifies values set for instance attributes as compared to the values requested by user in the corresponding input only field. (id: ResourceStatus) |
satisfiesPzi | boolean | Output only. [Output Only] Reserved for future use. |
satisfiesPzs | boolean | Output only. [Output Only] Reserved for future use. |
scheduling | object | Sets the scheduling options for this instance. (id: Scheduling) |
selfLink | string | Output only. [Output Only] Server-defined URL for this resource. |
serviceAccounts | array | A list of service accounts, with their specified scopes, authorized for this instance. Only one service account per VM instance is supported. Service accounts generate access tokens that can be accessed through the metadata server and used to authenticate applications on the instance. SeeService Accounts for more information. |
shieldedInstanceConfig | object | A set of Shielded Instance options. (id: ShieldedInstanceConfig) |
shieldedInstanceIntegrityPolicy | object | The policy describes the baseline against which Instance boot integrity is measured. (id: ShieldedInstanceIntegrityPolicy) |
sourceMachineImage | string | Source machine image |
sourceMachineImageEncryptionKey | object | Source machine image encryption key when creating an instance from a machine image. (id: CustomerEncryptionKey) |
startRestricted | boolean | Output only. [Output Only] Whether a VM has been restricted for start because Compute Engine has detected suspicious activity. |
status | string | Output only. [Output Only] The status of the instance. One of the following values: PROVISIONING, STAGING,RUNNING, STOPPING, SUSPENDING,SUSPENDED, REPAIRING, andTERMINATED. For more information about the status of the instance, see Instance life cycle. (DEPROVISIONING, PENDING, PENDING_STOP, PROVISIONING, REPAIRING, RUNNING, STAGING, STOPPED, STOPPING, SUSPENDED, SUSPENDING, TERMINATED) |
statusMessage | string | Output only. [Output Only] An optional, human-readable explanation of the status. |
tags | object | Tags to apply to this instance. Tags are used to identify valid sources or targets for network firewalls and are specified by the client during instance creation. The tags can be later modified by the setTags method. Each tag within the list must comply withRFC1035. Multiple tags can be specified via the 'tags.items' field. (id: Tags) |
workloadIdentityConfig | object | (id: WorkloadIdentityConfig) |
zone | string | Output only. [Output Only] URL of the zone where the instance resides. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body. |
| Name | Datatype | Description |
|---|---|---|
id | string | [Output Only] Unique identifier for the resource; defined by the server. |
items | array | A list of Instance resources. |
kind | string | Output only. [Output Only] Type of resource. Always compute#instanceList for lists of Instance resources. (default: compute#instanceList) |
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] The unique identifier for the resource. This identifier is defined by the server. |
name | string | The name of the resource, provided by the client when initially creating the resource. The resource 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])?) |
advancedMachineFeatures | object | Controls for advanced machine-related behavior features. (id: AdvancedMachineFeatures) |
canIpForward | boolean | Allows this instance to send and receive packets with non-matching destination or source IPs. This is required if you plan to use this instance to forward routes. For more information, seeEnabling IP Forwarding. |
confidentialInstanceConfig | object | A set of Confidential Instance options. (id: ConfidentialInstanceConfig) |
cpuPlatform | string | Output only. [Output Only] The CPU platform used by this instance. |
creationTimestamp | string | Output only. [Output Only] Creation timestamp inRFC3339 text format. |
deletionProtection | boolean | Whether the resource should be protected against deletion. |
description | string | An optional description of this resource. Provide this property when you create the resource. |
disks | array | Array of disks associated with this instance. Persistent disks must be created before you can assign them. |
displayDevice | object | Enables display device for the instance. (id: DisplayDevice) |
fingerprint | string (byte) | Specifies a fingerprint for this resource, which is essentially a hash of the instance's contents and used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update the instance. You must always provide an up-to-date fingerprint hash in order to update the instance. To see the latest fingerprint, make get() request to the instance. |
guestAccelerators | array | A list of the type and count of accelerator cards attached to the instance. |
hostname | string | Specifies the hostname of the instance. The specified hostname must be RFC1035 compliant. If hostname is not specified, the default hostname is [INSTANCE_NAME].c.[PROJECT_ID].internal when using the global DNS, and [INSTANCE_NAME].[ZONE].c.[PROJECT_ID].internal when using zonal DNS. |
instanceEncryptionKey | object | Encrypts suspended data for an instance with acustomer-managed encryption key. If you are creating a new instance, this field will encrypt the local SSD and in-memory contents of the instance during the suspend operation. If you do not provide an encryption key when creating the instance, then the local SSD and in-memory contents will be encrypted using an automatically generated key during the suspend operation. (id: CustomerEncryptionKey) |
keyRevocationActionType | string | KeyRevocationActionType of the instance. Supported options are "STOP" and "NONE". The default value is "NONE" if it is not specified. (KEY_REVOCATION_ACTION_TYPE_UNSPECIFIED, NONE, STOP) |
kind | string | Output only. [Output Only] Type of the resource. Always compute#instance for instances. (default: compute#instance) |
labelFingerprint | string (byte) | A fingerprint for this request, which is essentially a hash of the label's contents and used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash in order to update or change labels. To see the latest fingerprint, make get() request to the instance. |
labels | object | Labels to apply to this instance. These can be later modified by the setLabels method. |
lastStartTimestamp | string | Output only. [Output Only] Last start timestamp inRFC3339 text format. |
lastStopTimestamp | string | Output only. [Output Only] Last stop timestamp inRFC3339 text format. |
lastSuspendedTimestamp | string | Output only. [Output Only] Last suspended timestamp inRFC3339 text format. |
localSsdEncryptionMode | string | Specifies which method should be used for encrypting the Local SSDs attached to the VM. (EPHEMERAL_KEY_ENCRYPTION, LOCAL_SSD_ENCRYPTION_MODE_UNSPECIFIED, STANDARD_ENCRYPTION) |
machineType | string | Full or partial URL of the machine type resource to use for this instance, in the format:zones/zone/machineTypes/machine-type. This is provided by the client when the instance is created. For example, the following is a valid partial url to a predefined machine type: zones/us-central1-f/machineTypes/n1-standard-1 To create acustom machine type, provide a URL to a machine type in the following format, where CPUS is 1 or an even number up to 32 (2, 4, 6, ... 24, etc), and MEMORY is the total memory for this instance. Memory must be a multiple of 256 MB and must be supplied in MB (e.g. 5 GB of memory is 5120 MB): zones/zone/machineTypes/custom-CPUS-MEMORY For example: zones/us-central1-f/machineTypes/custom-4-5120 For a full list of restrictions, read theSpecifications for custom machine types. |
metadata | object | The metadata key/value pairs assigned to this instance. This includes metadata keys that were explicitly defined for the instance. (id: Metadata) |
minCpuPlatform | string | Specifies aminimum CPU platform for the VM instance. Applicable values are the friendly names of CPU platforms, such as minCpuPlatform: "Intel Haswell" or minCpuPlatform: "Intel Sandy Bridge". |
networkInterfaces | array | An array of network configurations for this instance. These specify how interfaces are configured to interact with other network services, such as connecting to the internet. Multiple interfaces are supported per instance. |
networkPerformanceConfig | object | (id: NetworkPerformanceConfig) |
params | object | Input only. [Input Only] Additional params passed with the request, but not persisted as part of resource payload. (id: InstanceParams) |
privateIpv6GoogleAccess | string | The private IPv6 google access type for the VM. If not specified, use INHERIT_FROM_SUBNETWORK as default. (ENABLE_BIDIRECTIONAL_ACCESS_TO_GOOGLE, ENABLE_OUTBOUND_VM_ACCESS_TO_GOOGLE, INHERIT_FROM_SUBNETWORK) |
reservationAffinity | object | Specifies the reservations that this instance can consume from. (id: ReservationAffinity) |
resourcePolicies | array | Resource policies applied to this instance. |
resourceStatus | object | Output only. [Output Only] Specifies values set for instance attributes as compared to the values requested by user in the corresponding input only field. (id: ResourceStatus) |
satisfiesPzi | boolean | Output only. [Output Only] Reserved for future use. |
satisfiesPzs | boolean | Output only. [Output Only] Reserved for future use. |
scheduling | object | Sets the scheduling options for this instance. (id: Scheduling) |
selfLink | string | Output only. [Output Only] Server-defined URL for this resource. |
serviceAccounts | array | A list of service accounts, with their specified scopes, authorized for this instance. Only one service account per VM instance is supported. Service accounts generate access tokens that can be accessed through the metadata server and used to authenticate applications on the instance. SeeService Accounts for more information. |
shieldedInstanceConfig | object | A set of Shielded Instance options. (id: ShieldedInstanceConfig) |
shieldedInstanceIntegrityPolicy | object | The policy describes the baseline against which Instance boot integrity is measured. (id: ShieldedInstanceIntegrityPolicy) |
sourceMachineImage | string | Source machine image |
sourceMachineImageEncryptionKey | object | Source machine image encryption key when creating an instance from a machine image. (id: CustomerEncryptionKey) |
startRestricted | boolean | Output only. [Output Only] Whether a VM has been restricted for start because Compute Engine has detected suspicious activity. |
status | string | Output only. [Output Only] The status of the instance. One of the following values: PROVISIONING, STAGING,RUNNING, STOPPING, SUSPENDING,SUSPENDED, REPAIRING, andTERMINATED. For more information about the status of the instance, see Instance life cycle. (DEPROVISIONING, PENDING, PENDING_STOP, PROVISIONING, REPAIRING, RUNNING, STAGING, STOPPED, STOPPING, SUSPENDED, SUSPENDING, TERMINATED) |
statusMessage | string | Output only. [Output Only] An optional, human-readable explanation of the status. |
tags | object | Tags to apply to this instance. Tags are used to identify valid sources or targets for network firewalls and are specified by the client during instance creation. The tags can be later modified by the setTags method. Each tag within the list must comply withRFC1035. Multiple tags can be specified via the 'tags.items' field. (id: Tags) |
workloadIdentityConfig | object | (id: WorkloadIdentityConfig) |
zone | string | Output only. [Output Only] URL of the zone where the instance resides. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | project, zone, instance | Returns the specified Instance resource. | |
list | select | project, zone | maxResults, pageToken, filter, orderBy, returnPartialSuccess | Retrieves the list of instances contained within the specified zone. |
aggregated_list | select | project | returnPartialSuccess, maxResults, pageToken, filter, serviceProjectNumber, includeAllScopes, orderBy | Retrieves an aggregated list of all of the instances in your project across all regions and zones. The performance of this method degrades when a filter is specified on a project that has a very large number of instances. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true. |
insert | insert | project, zone | sourceInstanceTemplate, sourceMachineImage, requestId | Creates an instance resource in the specified project using the data included in the request. |
update | replace | project, zone, instance | mostDisruptiveAllowedAction, requestId, minimalAction, discardLocalSsd | Updates an instance only if the necessary resources are available. This method can update only a specific set of instance properties. See Updating a running instance for a list of updatable instance properties. |
delete | delete | project, zone, instance | noGracefulShutdown, requestId | Deletes the specified Instance resource. For more information, seeDeleting an instance. |
bulk_insert | exec | project, zone | requestId | Creates multiple instances. Count specifies the number of instances to create. For more information, seeAbout bulk creation of VMs. |
set_machine_resources | exec | project, zone, instance | requestId | Changes the number and/or type of accelerator for a stopped instance to the values specified in the request. |
set_tags | exec | project, zone, instance | requestId | Sets network tags for the specified instance to the data included in the request. |
perform_maintenance | exec | project, zone, instance | requestId | Perform a manual maintenance on the instance. |
set_scheduling | exec | project, zone, instance | requestId | Sets an instance's scheduling options. You can only call this method on astopped instance, that is, a VM instance that is in a TERMINATED state. SeeInstance LifeCycle for more information on the possible instance states. For more information about setting scheduling options for a VM, seeSet VM host maintenance policy. |
set_labels | exec | project, zone, instance | requestId | Sets labels on an instance. To learn more about labels, read theLabeling Resources documentation. |
set_shielded_instance_integrity_policy | exec | project, zone, instance | requestId | Sets the Shielded Instance integrity policy for an instance. You can only use this method on a running instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. |
start_with_encryption_key | exec | project, zone, instance | requestId | Starts an instance that was stopped using theinstances().stop method. For more information, seeRestart an instance. |
stop | exec | project, zone, instance | requestId, noGracefulShutdown, discardLocalSsd | Stops a running instance, shutting it down cleanly, and allows you to restart the instance at a later time. Stopped instances do not incur VM usage charges while they are stopped. However, resources that the VM is using, such as persistent disks and static IP addresses, will continue to be charged until they are deleted. For more information, seeStopping an instance. |
report_host_as_faulty | exec | project, zone, instance | requestId | Mark the host as faulty and try to restart the instance on a new host. |
attach_disk | exec | project, zone, instance | forceAttach, requestId | Attaches an existing Disk resource to an instance. You must first create the disk before you can attach it. It is not possible to create and attach a disk at the same time. For more information, readAdding a persistent disk to your instance. |
set_deletion_protection | exec | project, zone, resource | requestId, deletionProtection | Sets deletion protection on the instance. |
set_metadata | exec | project, zone, instance | requestId | Sets metadata for the specified instance to the data included in the request. |
set_min_cpu_platform | exec | project, zone, instance | requestId | Changes the minimum CPU platform that this instance should use. This method can only be called on a stopped instance. For more information, readSpecifying a Minimum CPU Platform. |
set_service_account | exec | project, zone, instance | requestId | Sets the service account on the instance. For more information, readChanging the service account and access scopes for an instance. |
update_network_interface | exec | project, zone, instance, networkInterface | requestId | Updates an instance's network interface. This method can only update an interface's alias IP range and attached network. See Modifying alias IP ranges for an existing instance for instructions on changing alias IP ranges. See Migrating a VM between networks for instructions on migrating an interface. This method follows PATCH semantics. |
set_disk_auto_delete | exec | project, zone, instance, autoDelete, deviceName | requestId | Sets the auto-delete flag for a disk attached to an instance. |
detach_disk | exec | project, zone, instance, deviceName | requestId | Detaches a disk from an instance. |
update_shielded_instance_config | exec | project, zone, instance | requestId | Updates the Shielded Instance config for an instance. You can only use this method on a stopped instance. This method supportsPATCH semantics and uses theJSON merge patch format and processing rules. |
simulate_maintenance_event | exec | project, zone, instance | requestId, withExtendedNotifications | Simulates a host maintenance event on a VM. For more information, see Simulate a host maintenance event. |
start | exec | project, zone, instance | requestId | Starts an instance that was stopped using theinstances().stop method. For more information, seeRestart an instance. |
resume | exec | project, zone, instance | requestId | Resumes an instance that was suspended using theinstances().suspend method. |
reset | exec | project, zone, instance | requestId | Performs a reset on the instance. This is a hard reset. The VM does not do a graceful shutdown. For more information, seeResetting an instance. |
update_display_device | exec | project, zone, instance | requestId | Updates the Display config for a VM instance. You can only use this method on a stopped VM instance. This method supportsPATCH semantics and uses theJSON merge patch format and processing rules. |
set_machine_type | exec | project, zone, instance | requestId | Changes the machine type for a stopped instance to the machine type specified in the request. |
set_security_policy | exec | project, zone, instance | requestId | Sets the Google Cloud Armor security policy for the specified instance. For more information, seeGoogle Cloud Armor Overview |
send_diagnostic_interrupt | exec | project, zone, instance | Sends diagnostic interrupt to the instance. | |
set_name | exec | project, zone, instance | requestId | Sets name of an instance. |
suspend | exec | project, zone, instance | discardLocalSsd, requestId | This method suspends a running instance, saving its state to persistent storage, and allows you to resume the instance at a later time. Suspended instances have no compute costs (cores or RAM), and incur only storage charges for the saved VM memory and localSSD data. Any charged resources the virtual machine was using, such as persistent disks and static IP addresses, will continue to be charged while the instance is suspended. For more information, see Suspending and resuming an instance. |
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 |
|---|---|---|
autoDelete | boolean | |
deviceName | string | |
instance | string | |
networkInterface | string | |
project | string | |
resource | string | |
zone | string | |
deletionProtection | boolean | |
discardLocalSsd | boolean | |
filter | string | |
forceAttach | boolean | |
includeAllScopes | boolean | |
maxResults | integer (uint32) | |
minimalAction | string | |
mostDisruptiveAllowedAction | string | |
noGracefulShutdown | boolean | |
orderBy | string | |
pageToken | string | |
requestId | string | |
returnPartialSuccess | boolean | |
serviceProjectNumber | string (int64) | |
sourceInstanceTemplate | string | |
sourceMachineImage | string | |
withExtendedNotifications | boolean |
SELECT examples
- get
- list
- aggregated_list
Returns the specified Instance resource.
SELECT
id,
name,
advancedMachineFeatures,
canIpForward,
confidentialInstanceConfig,
cpuPlatform,
creationTimestamp,
deletionProtection,
description,
disks,
displayDevice,
fingerprint,
guestAccelerators,
hostname,
instanceEncryptionKey,
keyRevocationActionType,
kind,
labelFingerprint,
labels,
lastStartTimestamp,
lastStopTimestamp,
lastSuspendedTimestamp,
localSsdEncryptionMode,
machineType,
metadata,
minCpuPlatform,
networkInterfaces,
networkPerformanceConfig,
params,
privateIpv6GoogleAccess,
reservationAffinity,
resourcePolicies,
resourceStatus,
satisfiesPzi,
satisfiesPzs,
scheduling,
selfLink,
serviceAccounts,
shieldedInstanceConfig,
shieldedInstanceIntegrityPolicy,
sourceMachineImage,
sourceMachineImageEncryptionKey,
startRestricted,
status,
statusMessage,
tags,
workloadIdentityConfig,
zone
FROM google.compute.instances
WHERE project = '{{ project }}' -- required
AND zone = '{{ zone }}' -- required
AND instance = '{{ instance }}' -- required
;
Retrieves the list of instances contained within
the specified zone.
SELECT
id,
items,
kind,
nextPageToken,
selfLink,
warning
FROM google.compute.instances
WHERE project = '{{ project }}' -- required
AND zone = '{{ zone }}' -- required
AND maxResults = '{{ maxResults }}'
AND pageToken = '{{ pageToken }}'
AND filter = '{{ filter }}'
AND orderBy = '{{ orderBy }}'
AND returnPartialSuccess = '{{ returnPartialSuccess }}'
;
Retrieves an aggregated list of all of the instances in your project
across all regions and zones.
The performance of this method degrades when a filter is specified on a
project that has a very large number of instances.
To prevent failure, Google recommends that you set thereturnPartialSuccess parameter to true.
SELECT
id,
name,
advancedMachineFeatures,
canIpForward,
confidentialInstanceConfig,
cpuPlatform,
creationTimestamp,
deletionProtection,
description,
disks,
displayDevice,
fingerprint,
guestAccelerators,
hostname,
instanceEncryptionKey,
keyRevocationActionType,
kind,
labelFingerprint,
labels,
lastStartTimestamp,
lastStopTimestamp,
lastSuspendedTimestamp,
localSsdEncryptionMode,
machineType,
metadata,
minCpuPlatform,
networkInterfaces,
networkPerformanceConfig,
params,
privateIpv6GoogleAccess,
reservationAffinity,
resourcePolicies,
resourceStatus,
satisfiesPzi,
satisfiesPzs,
scheduling,
selfLink,
serviceAccounts,
shieldedInstanceConfig,
shieldedInstanceIntegrityPolicy,
sourceMachineImage,
sourceMachineImageEncryptionKey,
startRestricted,
status,
statusMessage,
tags,
workloadIdentityConfig,
zone
FROM google.compute.instances
WHERE project = '{{ project }}' -- required
AND returnPartialSuccess = '{{ returnPartialSuccess }}'
AND maxResults = '{{ maxResults }}'
AND pageToken = '{{ pageToken }}'
AND filter = '{{ filter }}'
AND serviceProjectNumber = '{{ serviceProjectNumber }}'
AND includeAllScopes = '{{ includeAllScopes }}'
AND orderBy = '{{ orderBy }}'
;
INSERT examples
- insert
- Manifest
Creates an instance resource in the specified project using the data
included in the request.
INSERT INTO google.compute.instances (
data__description,
data__disks,
data__metadata,
data__serviceAccounts,
data__keyRevocationActionType,
data__networkInterfaces,
data__name,
data__confidentialInstanceConfig,
data__displayDevice,
data__localSsdEncryptionMode,
data__resourcePolicies,
data__shieldedInstanceConfig,
data__reservationAffinity,
data__deletionProtection,
data__instanceEncryptionKey,
data__hostname,
data__labels,
data__advancedMachineFeatures,
data__sourceMachineImageEncryptionKey,
data__labelFingerprint,
data__workloadIdentityConfig,
data__params,
data__minCpuPlatform,
data__tags,
data__shieldedInstanceIntegrityPolicy,
data__canIpForward,
data__networkPerformanceConfig,
data__machineType,
data__sourceMachineImage,
data__fingerprint,
data__scheduling,
data__guestAccelerators,
data__privateIpv6GoogleAccess,
project,
zone,
sourceInstanceTemplate,
sourceMachineImage,
requestId
)
SELECT
'{{ description }}',
'{{ disks }}',
'{{ metadata }}',
'{{ serviceAccounts }}',
'{{ keyRevocationActionType }}',
'{{ networkInterfaces }}',
'{{ name }}',
'{{ confidentialInstanceConfig }}',
'{{ displayDevice }}',
'{{ localSsdEncryptionMode }}',
'{{ resourcePolicies }}',
'{{ shieldedInstanceConfig }}',
'{{ reservationAffinity }}',
{{ deletionProtection }},
'{{ instanceEncryptionKey }}',
'{{ hostname }}',
'{{ labels }}',
'{{ advancedMachineFeatures }}',
'{{ sourceMachineImageEncryptionKey }}',
'{{ labelFingerprint }}',
'{{ workloadIdentityConfig }}',
'{{ params }}',
'{{ minCpuPlatform }}',
'{{ tags }}',
'{{ shieldedInstanceIntegrityPolicy }}',
{{ canIpForward }},
'{{ networkPerformanceConfig }}',
'{{ machineType }}',
'{{ sourceMachineImage }}',
'{{ fingerprint }}',
'{{ scheduling }}',
'{{ guestAccelerators }}',
'{{ privateIpv6GoogleAccess }}',
'{{ project }}',
'{{ zone }}',
'{{ sourceInstanceTemplate }}',
'{{ sourceMachineImage }}',
'{{ 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: instances
props:
- name: project
value: "{{ project }}"
description: Required parameter for the instances resource.
- name: zone
value: "{{ zone }}"
description: Required parameter for the instances resource.
- name: description
value: "{{ description }}"
description: |
An optional description of this resource. Provide this property when you
create the resource.
- name: disks
description: |
Array of disks associated with this instance. Persistent disks must be
created before you can assign them.
value:
- 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 }}"
- name: metadata
description: |
The metadata key/value pairs assigned
to this instance. This includes metadata keys that were explicitly defined
for the instance.
value:
fingerprint: "{{ fingerprint }}"
items:
- key: "{{ key }}"
value: "{{ value }}"
kind: "{{ kind }}"
- name: serviceAccounts
description: |
A list of service accounts, with their specified scopes, authorized for
this instance. Only one service account per VM instance is supported.
Service accounts generate access tokens that can be accessed
through the metadata server and used to authenticate applications on the
instance. SeeService Accounts
for more information.
value:
- scopes: "{{ scopes }}"
email: "{{ email }}"
- name: keyRevocationActionType
value: "{{ keyRevocationActionType }}"
description: |
KeyRevocationActionType of the instance. Supported options are "STOP" and
"NONE". The default value is "NONE" if it is not specified.
valid_values: ['KEY_REVOCATION_ACTION_TYPE_UNSPECIFIED', 'NONE', 'STOP']
- name: networkInterfaces
description: |
An array of network configurations for this instance. These specify how
interfaces are configured to interact with other network services, such as
connecting to the internet. Multiple interfaces are supported
per instance.
value:
- 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 }}
- name: name
value: "{{ name }}"
description: |
The name of the resource, provided by the client when initially creating
the resource. The resource 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: confidentialInstanceConfig
description: |
A set of Confidential Instance options.
value:
enableConfidentialCompute: {{ enableConfidentialCompute }}
confidentialInstanceType: "{{ confidentialInstanceType }}"
- name: displayDevice
description: |
Enables display device for the instance.
value:
enableDisplay: {{ enableDisplay }}
- name: localSsdEncryptionMode
value: "{{ localSsdEncryptionMode }}"
description: |
Specifies which method should be used for encrypting the
Local SSDs attached to the VM.
valid_values: ['EPHEMERAL_KEY_ENCRYPTION', 'LOCAL_SSD_ENCRYPTION_MODE_UNSPECIFIED', 'STANDARD_ENCRYPTION']
- name: resourcePolicies
value:
- "{{ resourcePolicies }}"
description: |
Resource policies applied to this instance.
- name: shieldedInstanceConfig
description: |
A set of Shielded Instance options.
value:
enableSecureBoot: {{ enableSecureBoot }}
enableIntegrityMonitoring: {{ enableIntegrityMonitoring }}
enableVtpm: {{ enableVtpm }}
- name: reservationAffinity
description: |
Specifies the reservations that this instance can consume from.
value:
consumeReservationType: "{{ consumeReservationType }}"
key: "{{ key }}"
values:
- "{{ values }}"
- name: deletionProtection
value: {{ deletionProtection }}
description: |
Whether the resource should be protected against deletion.
- name: instanceEncryptionKey
description: |
Encrypts suspended data for an instance with acustomer-managed
encryption key.
If you are creating a new instance, this field will encrypt the local SSD
and in-memory contents of the instance during the suspend operation.
If you do not provide an encryption key when creating the instance, then
the local SSD and in-memory contents will be encrypted using
an automatically generated key during the suspend operation.
value:
rawKey: "{{ rawKey }}"
kmsKeyServiceAccount: "{{ kmsKeyServiceAccount }}"
rsaEncryptedKey: "{{ rsaEncryptedKey }}"
kmsKeyName: "{{ kmsKeyName }}"
sha256: "{{ sha256 }}"
- name: hostname
value: "{{ hostname }}"
description: |
Specifies the hostname of the instance. The specified hostname must be
RFC1035 compliant. If hostname is not specified, the default hostname is
[INSTANCE_NAME].c.[PROJECT_ID].internal when using the global DNS, and
[INSTANCE_NAME].[ZONE].c.[PROJECT_ID].internal when using zonal DNS.
- name: labels
value: "{{ labels }}"
description: |
Labels to apply to this instance. These can be later modified by
the setLabels method.
- name: advancedMachineFeatures
description: |
Controls for advanced machine-related behavior features.
value:
enableUefiNetworking: {{ enableUefiNetworking }}
performanceMonitoringUnit: "{{ performanceMonitoringUnit }}"
threadsPerCore: {{ threadsPerCore }}
visibleCoreCount: {{ visibleCoreCount }}
enableNestedVirtualization: {{ enableNestedVirtualization }}
turboMode: "{{ turboMode }}"
- name: sourceMachineImageEncryptionKey
description: |
Source machine image encryption key when creating an instance from a
machine image.
value:
rawKey: "{{ rawKey }}"
kmsKeyServiceAccount: "{{ kmsKeyServiceAccount }}"
rsaEncryptedKey: "{{ rsaEncryptedKey }}"
kmsKeyName: "{{ kmsKeyName }}"
sha256: "{{ sha256 }}"
- name: labelFingerprint
value: "{{ labelFingerprint }}"
description: |
A fingerprint for this request, which is essentially a hash of
the label's contents and used for optimistic locking. The
fingerprint is initially generated by Compute Engine and changes after
every request to modify or update labels. You must always provide an
up-to-date fingerprint hash in order to update or change labels.
To see the latest fingerprint, make get() request to the
instance.
- name: workloadIdentityConfig
value:
identityCertificateEnabled: {{ identityCertificateEnabled }}
identity: "{{ identity }}"
- name: params
description: |
Input only. [Input Only] Additional params passed with the request, but not persisted
as part of resource payload.
value:
requestValidForDuration:
nanos: {{ nanos }}
seconds: "{{ seconds }}"
resourceManagerTags: "{{ resourceManagerTags }}"
- name: minCpuPlatform
value: "{{ minCpuPlatform }}"
description: |
Specifies aminimum CPU
platform for the VM instance. Applicable values are the friendly names
of CPU platforms, such as minCpuPlatform: "Intel
Haswell" or minCpuPlatform: "Intel Sandy
Bridge".
- name: tags
description: |
Tags to apply to this instance. Tags are used to identify valid
sources or targets for network firewalls and are specified by the client
during instance creation. The tags can be later modified by the setTags
method. Each tag within the list must comply withRFC1035.
Multiple tags can be specified via the 'tags.items' field.
value:
items:
- "{{ items }}"
fingerprint: "{{ fingerprint }}"
- name: shieldedInstanceIntegrityPolicy
description: |
The policy describes the baseline against which
Instance boot integrity is measured.
value:
updateAutoLearnPolicy: {{ updateAutoLearnPolicy }}
- name: canIpForward
value: {{ canIpForward }}
description: |
Allows this instance to send and receive packets with non-matching
destination or source IPs. This is required if you plan to use this
instance to forward routes. For more information, seeEnabling IP Forwarding.
- name: networkPerformanceConfig
value:
totalEgressBandwidthTier: "{{ totalEgressBandwidthTier }}"
- name: machineType
value: "{{ machineType }}"
description: |
Full or partial URL of the machine type resource to use for this instance,
in the format:zones/zone/machineTypes/machine-type. This is provided by the client
when the instance is created. For example, the following is a valid partial
url to a predefined
machine type:
zones/us-central1-f/machineTypes/n1-standard-1
To create acustom
machine type, provide a URL to a machine type in the following format,
where CPUS is 1 or an even number up to 32 (2,
4, 6, ... 24, etc), and MEMORY is the total
memory for this instance. Memory must be a multiple of 256 MB and must
be supplied in MB (e.g. 5 GB of memory is 5120 MB):
zones/zone/machineTypes/custom-CPUS-MEMORY
For example: zones/us-central1-f/machineTypes/custom-4-5120
For a full list of restrictions, read theSpecifications
for custom machine types.
- name: sourceMachineImage
value: "{{ sourceMachineImage }}"
description: |
Source machine image
- name: fingerprint
value: "{{ fingerprint }}"
description: |
Specifies a fingerprint for this resource, which is essentially a hash of
the instance's contents and used for optimistic locking. The
fingerprint is initially generated by Compute Engine and changes after
every request to modify or update the instance. You must always provide an
up-to-date fingerprint hash in order to update the instance.
To see the latest fingerprint, make get() request to the
instance.
- name: scheduling
description: |
Sets the scheduling options for this instance.
value:
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 }}"
- name: guestAccelerators
description: |
A list of the type and count of accelerator cards attached to the instance.
value:
- acceleratorType: "{{ acceleratorType }}"
acceleratorCount: {{ acceleratorCount }}
- name: privateIpv6GoogleAccess
value: "{{ privateIpv6GoogleAccess }}"
description: |
The private IPv6 google access type for the VM.
If not specified, use INHERIT_FROM_SUBNETWORK as default.
valid_values: ['ENABLE_BIDIRECTIONAL_ACCESS_TO_GOOGLE', 'ENABLE_OUTBOUND_VM_ACCESS_TO_GOOGLE', 'INHERIT_FROM_SUBNETWORK']
- name: sourceInstanceTemplate
value: "{{ sourceInstanceTemplate }}"
- name: sourceMachineImage
value: "{{ sourceMachineImage }}"
- name: requestId
value: "{{ requestId }}"
REPLACE examples
- update
Updates an instance only if the necessary resources are available. This
method can update only a specific set of instance properties. See
Updating a running instance for a list of updatable instance
properties.
REPLACE google.compute.instances
SET
data__description = '{{ description }}',
data__disks = '{{ disks }}',
data__metadata = '{{ metadata }}',
data__serviceAccounts = '{{ serviceAccounts }}',
data__keyRevocationActionType = '{{ keyRevocationActionType }}',
data__networkInterfaces = '{{ networkInterfaces }}',
data__name = '{{ name }}',
data__confidentialInstanceConfig = '{{ confidentialInstanceConfig }}',
data__displayDevice = '{{ displayDevice }}',
data__localSsdEncryptionMode = '{{ localSsdEncryptionMode }}',
data__resourcePolicies = '{{ resourcePolicies }}',
data__shieldedInstanceConfig = '{{ shieldedInstanceConfig }}',
data__reservationAffinity = '{{ reservationAffinity }}',
data__deletionProtection = {{ deletionProtection }},
data__instanceEncryptionKey = '{{ instanceEncryptionKey }}',
data__hostname = '{{ hostname }}',
data__labels = '{{ labels }}',
data__advancedMachineFeatures = '{{ advancedMachineFeatures }}',
data__sourceMachineImageEncryptionKey = '{{ sourceMachineImageEncryptionKey }}',
data__labelFingerprint = '{{ labelFingerprint }}',
data__workloadIdentityConfig = '{{ workloadIdentityConfig }}',
data__params = '{{ params }}',
data__minCpuPlatform = '{{ minCpuPlatform }}',
data__tags = '{{ tags }}',
data__shieldedInstanceIntegrityPolicy = '{{ shieldedInstanceIntegrityPolicy }}',
data__canIpForward = {{ canIpForward }},
data__networkPerformanceConfig = '{{ networkPerformanceConfig }}',
data__machineType = '{{ machineType }}',
data__sourceMachineImage = '{{ sourceMachineImage }}',
data__fingerprint = '{{ fingerprint }}',
data__scheduling = '{{ scheduling }}',
data__guestAccelerators = '{{ guestAccelerators }}',
data__privateIpv6GoogleAccess = '{{ privateIpv6GoogleAccess }}'
WHERE
project = '{{ project }}' --required
AND zone = '{{ zone }}' --required
AND instance = '{{ instance }}' --required
AND mostDisruptiveAllowedAction = '{{ mostDisruptiveAllowedAction}}'
AND requestId = '{{ requestId}}'
AND minimalAction = '{{ minimalAction}}'
AND discardLocalSsd = {{ discardLocalSsd}}
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;
DELETE examples
- delete
Deletes the specified Instance resource. For more information, seeDeleting
an instance.
DELETE FROM google.compute.instances
WHERE project = '{{ project }}' --required
AND zone = '{{ zone }}' --required
AND instance = '{{ instance }}' --required
AND noGracefulShutdown = '{{ noGracefulShutdown }}'
AND requestId = '{{ requestId }}'
;
Lifecycle Methods
- bulk_insert
- set_machine_resources
- set_tags
- perform_maintenance
- set_scheduling
- set_labels
- set_shielded_instance_integrity_policy
- start_with_encryption_key
- stop
- report_host_as_faulty
- attach_disk
- set_deletion_protection
- set_metadata
- set_min_cpu_platform
- set_service_account
- update_network_interface
- set_disk_auto_delete
- detach_disk
- update_shielded_instance_config
- simulate_maintenance_event
- start
- resume
- reset
- update_display_device
- set_machine_type
- set_security_policy
- send_diagnostic_interrupt
- set_name
- suspend
Creates multiple instances. Count specifies the number of instances to
create. For more information, seeAbout bulk
creation of VMs.
EXEC google.compute.instances.bulk_insert
@project='{{ project }}' --required,
@zone='{{ zone }}' --required,
@requestId='{{ requestId }}'
@@json=
'{
"sourceInstanceTemplate": "{{ sourceInstanceTemplate }}",
"instanceProperties": "{{ instanceProperties }}",
"count": "{{ count }}",
"minCount": "{{ minCount }}",
"namePattern": "{{ namePattern }}",
"perInstanceProperties": "{{ perInstanceProperties }}",
"locationPolicy": "{{ locationPolicy }}",
"instanceFlexibilityPolicy": "{{ instanceFlexibilityPolicy }}"
}'
;
Changes the number and/or type of accelerator for a stopped instance to the
values specified in the request.
EXEC google.compute.instances.set_machine_resources
@project='{{ project }}' --required,
@zone='{{ zone }}' --required,
@instance='{{ instance }}' --required,
@requestId='{{ requestId }}'
@@json=
'{
"guestAccelerators": "{{ guestAccelerators }}"
}'
;
Sets network tags
for the specified instance to the data included in the request.
EXEC google.compute.instances.set_tags
@project='{{ project }}' --required,
@zone='{{ zone }}' --required,
@instance='{{ instance }}' --required,
@requestId='{{ requestId }}'
@@json=
'{
"items": "{{ items }}",
"fingerprint": "{{ fingerprint }}"
}'
;
Perform a manual maintenance on the instance.
EXEC google.compute.instances.perform_maintenance
@project='{{ project }}' --required,
@zone='{{ zone }}' --required,
@instance='{{ instance }}' --required,
@requestId='{{ requestId }}'
;
Sets an instance's scheduling options. You can only call this method on astopped instance,
that is, a VM instance that is in a TERMINATED state. SeeInstance Life
Cycle for more information on the possible instance states.
For more information about setting scheduling options for a VM, seeSet
VM host maintenance policy.
EXEC google.compute.instances.set_scheduling
@project='{{ project }}' --required,
@zone='{{ zone }}' --required,
@instance='{{ instance }}' --required,
@requestId='{{ requestId }}'
@@json=
'{
"onHostMaintenance": "{{ onHostMaintenance }}",
"hostErrorTimeoutSeconds": {{ hostErrorTimeoutSeconds }},
"provisioningModel": "{{ provisioningModel }}",
"availabilityDomain": {{ availabilityDomain }},
"onInstanceStopAction": "{{ onInstanceStopAction }}",
"nodeAffinities": "{{ nodeAffinities }}",
"maxRunDuration": "{{ maxRunDuration }}",
"instanceTerminationAction": "{{ instanceTerminationAction }}",
"preemptionNoticeDuration": "{{ preemptionNoticeDuration }}",
"preemptible": {{ preemptible }},
"skipGuestOsShutdown": {{ skipGuestOsShutdown }},
"terminationTime": "{{ terminationTime }}",
"localSsdRecoveryTimeout": "{{ localSsdRecoveryTimeout }}",
"minNodeCpus": {{ minNodeCpus }},
"gracefulShutdown": "{{ gracefulShutdown }}",
"automaticRestart": {{ automaticRestart }},
"locationHint": "{{ locationHint }}"
}'
;
Sets labels on an instance. To learn more about labels, read theLabeling
Resources documentation.
EXEC google.compute.instances.set_labels
@project='{{ project }}' --required,
@zone='{{ zone }}' --required,
@instance='{{ instance }}' --required,
@requestId='{{ requestId }}'
@@json=
'{
"labels": "{{ labels }}",
"labelFingerprint": "{{ labelFingerprint }}"
}'
;
Sets the Shielded Instance integrity policy for an instance. You can
only use this method on a running instance. This method
supports PATCH semantics and uses the JSON merge
patch format and processing rules.
EXEC google.compute.instances.set_shielded_instance_integrity_policy
@project='{{ project }}' --required,
@zone='{{ zone }}' --required,
@instance='{{ instance }}' --required,
@requestId='{{ requestId }}'
@@json=
'{
"updateAutoLearnPolicy": {{ updateAutoLearnPolicy }}
}'
;
Starts an instance that was stopped using theinstances().stop
method. For more information, seeRestart an
instance.
EXEC google.compute.instances.start_with_encryption_key
@project='{{ project }}' --required,
@zone='{{ zone }}' --required,
@instance='{{ instance }}' --required,
@requestId='{{ requestId }}'
@@json=
'{
"disks": "{{ disks }}"
}'
;
Stops a running instance, shutting it down cleanly, and allows
you to restart the instance at a later time. Stopped instances do not incur
VM usage charges while they are stopped. However, resources that the VM is
using, such as persistent disks and static IP addresses, will continue to
be charged until they are deleted. For more information, seeStopping
an instance.
EXEC google.compute.instances.stop
@project='{{ project }}' --required,
@zone='{{ zone }}' --required,
@instance='{{ instance }}' --required,
@requestId='{{ requestId }}',
@noGracefulShutdown={{ noGracefulShutdown }},
@discardLocalSsd={{ discardLocalSsd }}
;
Mark the host as faulty and try to restart the instance on a new host.
EXEC google.compute.instances.report_host_as_faulty
@project='{{ project }}' --required,
@zone='{{ zone }}' --required,
@instance='{{ instance }}' --required,
@requestId='{{ requestId }}'
@@json=
'{
"faultReasons": "{{ faultReasons }}",
"disruptionSchedule": "{{ disruptionSchedule }}"
}'
;
Attaches an existing Disk resource to an instance. You must first
create the disk before you can attach it. It is not possible to create
and attach a disk at the same time. For more information, readAdding a
persistent disk to your instance.
EXEC google.compute.instances.attach_disk
@project='{{ project }}' --required,
@zone='{{ zone }}' --required,
@instance='{{ instance }}' --required,
@forceAttach={{ forceAttach }},
@requestId='{{ requestId }}'
@@json=
'{
"diskSizeGb": "{{ diskSizeGb }}",
"boot": {{ boot }},
"deviceName": "{{ deviceName }}",
"diskEncryptionKey": "{{ diskEncryptionKey }}",
"interface": "{{ interface }}",
"mode": "{{ mode }}",
"source": "{{ source }}",
"type": "{{ type }}",
"autoDelete": {{ autoDelete }},
"guestOsFeatures": "{{ guestOsFeatures }}",
"forceAttach": {{ forceAttach }},
"initializeParams": "{{ initializeParams }}"
}'
;
Sets deletion protection on the instance.
EXEC google.compute.instances.set_deletion_protection
@project='{{ project }}' --required,
@zone='{{ zone }}' --required,
@resource='{{ resource }}' --required,
@requestId='{{ requestId }}',
@deletionProtection={{ deletionProtection }}
;
Sets metadata for the specified instance to the data included
in the request.
EXEC google.compute.instances.set_metadata
@project='{{ project }}' --required,
@zone='{{ zone }}' --required,
@instance='{{ instance }}' --required,
@requestId='{{ requestId }}'
@@json=
'{
"fingerprint": "{{ fingerprint }}",
"items": "{{ items }}"
}'
;
Changes the minimum CPU platform that this instance should use.
This method can only
be called on a stopped instance. For more information, readSpecifying a
Minimum CPU Platform.
EXEC google.compute.instances.set_min_cpu_platform
@project='{{ project }}' --required,
@zone='{{ zone }}' --required,
@instance='{{ instance }}' --required,
@requestId='{{ requestId }}'
@@json=
'{
"minCpuPlatform": "{{ minCpuPlatform }}"
}'
;
Sets the service account on the instance. For more information,
readChanging
the service account and access scopes for an instance.
EXEC google.compute.instances.set_service_account
@project='{{ project }}' --required,
@zone='{{ zone }}' --required,
@instance='{{ instance }}' --required,
@requestId='{{ requestId }}'
@@json=
'{
"scopes": "{{ scopes }}",
"email": "{{ email }}"
}'
;
Updates an instance's network interface. This method can only update an
interface's alias IP range and attached network. See Modifying
alias IP ranges for an existing instance for instructions on
changing alias IP ranges. See Migrating
a VM between networks for instructions on migrating an interface.
This method follows PATCH semantics.
EXEC google.compute.instances.update_network_interface
@project='{{ project }}' --required,
@zone='{{ zone }}' --required,
@instance='{{ instance }}' --required,
@networkInterface='{{ networkInterface }}' --required,
@requestId='{{ requestId }}'
@@json=
'{
"ipv6Address": "{{ ipv6Address }}",
"parentNicName": "{{ parentNicName }}",
"fingerprint": "{{ fingerprint }}",
"igmpQuery": "{{ igmpQuery }}",
"serviceClassId": "{{ serviceClassId }}",
"subnetwork": "{{ subnetwork }}",
"network": "{{ network }}",
"stackType": "{{ stackType }}",
"accessConfigs": "{{ accessConfigs }}",
"networkAttachment": "{{ networkAttachment }}",
"queueCount": {{ queueCount }},
"name": "{{ name }}",
"networkIP": "{{ networkIP }}",
"vlan": {{ vlan }},
"internalIpv6PrefixLength": {{ internalIpv6PrefixLength }},
"nicType": "{{ nicType }}",
"aliasIpRanges": "{{ aliasIpRanges }}",
"ipv6AccessConfigs": "{{ ipv6AccessConfigs }}",
"aliasIpv6Ranges": "{{ aliasIpv6Ranges }}",
"enableVpcScopedDns": {{ enableVpcScopedDns }}
}'
;
Sets the auto-delete flag for a disk attached to an instance.
EXEC google.compute.instances.set_disk_auto_delete
@project='{{ project }}' --required,
@zone='{{ zone }}' --required,
@instance='{{ instance }}' --required,
@autoDelete='{{ autoDelete }}' --required,
@deviceName='{{ deviceName }}' --required,
@requestId='{{ requestId }}'
;
Detaches a disk from an instance.
EXEC google.compute.instances.detach_disk
@project='{{ project }}' --required,
@zone='{{ zone }}' --required,
@instance='{{ instance }}' --required,
@deviceName='{{ deviceName }}' --required,
@requestId='{{ requestId }}'
;
Updates the Shielded Instance config for an instance. You can
only use this method on a stopped instance. This method supportsPATCH
semantics and uses theJSON merge
patch format and processing rules.
EXEC google.compute.instances.update_shielded_instance_config
@project='{{ project }}' --required,
@zone='{{ zone }}' --required,
@instance='{{ instance }}' --required,
@requestId='{{ requestId }}'
@@json=
'{
"enableSecureBoot": {{ enableSecureBoot }},
"enableIntegrityMonitoring": {{ enableIntegrityMonitoring }},
"enableVtpm": {{ enableVtpm }}
}'
;
Simulates a host maintenance event on a VM. For more information, see
Simulate a host maintenance event.
EXEC google.compute.instances.simulate_maintenance_event
@project='{{ project }}' --required,
@zone='{{ zone }}' --required,
@instance='{{ instance }}' --required,
@requestId='{{ requestId }}',
@withExtendedNotifications={{ withExtendedNotifications }}
;
Starts an instance that was stopped using theinstances().stop
method. For more information, seeRestart an
instance.
EXEC google.compute.instances.start
@project='{{ project }}' --required,
@zone='{{ zone }}' --required,
@instance='{{ instance }}' --required,
@requestId='{{ requestId }}'
;
Resumes an instance that was suspended using theinstances().suspend
method.
EXEC google.compute.instances.resume
@project='{{ project }}' --required,
@zone='{{ zone }}' --required,
@instance='{{ instance }}' --required,
@requestId='{{ requestId }}'
;
Performs a reset on the instance. This is a hard reset. The VM
does not do a graceful shutdown. For more information, seeResetting
an instance.
EXEC google.compute.instances.reset
@project='{{ project }}' --required,
@zone='{{ zone }}' --required,
@instance='{{ instance }}' --required,
@requestId='{{ requestId }}'
;
Updates the Display config for a VM instance. You can
only use this method on a stopped VM instance. This method supportsPATCH
semantics and uses theJSON merge
patch format and processing rules.
EXEC google.compute.instances.update_display_device
@project='{{ project }}' --required,
@zone='{{ zone }}' --required,
@instance='{{ instance }}' --required,
@requestId='{{ requestId }}'
@@json=
'{
"enableDisplay": {{ enableDisplay }}
}'
;
Changes the machine type for a stopped instance to the machine
type specified in the request.
EXEC google.compute.instances.set_machine_type
@project='{{ project }}' --required,
@zone='{{ zone }}' --required,
@instance='{{ instance }}' --required,
@requestId='{{ requestId }}'
@@json=
'{
"machineType": "{{ machineType }}"
}'
;
Sets the Google Cloud Armor security policy for the specified instance.
For more information, seeGoogle
Cloud Armor Overview
EXEC google.compute.instances.set_security_policy
@project='{{ project }}' --required,
@zone='{{ zone }}' --required,
@instance='{{ instance }}' --required,
@requestId='{{ requestId }}'
@@json=
'{
"securityPolicy": "{{ securityPolicy }}",
"networkInterfaces": "{{ networkInterfaces }}"
}'
;
Sends diagnostic interrupt to the instance.
EXEC google.compute.instances.send_diagnostic_interrupt
@project='{{ project }}' --required,
@zone='{{ zone }}' --required,
@instance='{{ instance }}' --required
;
Sets name of an instance.
EXEC google.compute.instances.set_name
@project='{{ project }}' --required,
@zone='{{ zone }}' --required,
@instance='{{ instance }}' --required,
@requestId='{{ requestId }}'
@@json=
'{
"name": "{{ name }}",
"currentName": "{{ currentName }}"
}'
;
This method suspends a running instance, saving its state to persistent
storage, and allows you to resume the instance at a later time. Suspended
instances have no compute costs (cores or RAM), and incur only storage
charges for the saved VM memory and localSSD data. Any charged resources
the virtual machine was using, such as persistent disks and static IP
addresses, will continue to be charged while the instance is suspended.
For more information, see
Suspending and resuming an instance.
EXEC google.compute.instances.suspend
@project='{{ project }}' --required,
@zone='{{ zone }}' --required,
@instance='{{ instance }}' --required,
@discardLocalSsd={{ discardLocalSsd }},
@requestId='{{ requestId }}'
;