Skip to main content

instances

Overview

Nameinstances
TypeResource
Idgoogle.compute.instances

Fields

NameDatatypeDescription
idstring[Output Only] The unique identifier for the resource. This identifier is defined by the server.
namestringThe name of the resource, provided by the client when initially creating the resource. The resource 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.
descriptionstringAn optional description of this resource. Provide this property when you create the resource.
networkInterfacesarrayAn 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.
resourcePoliciesarrayResource policies applied to this instance.
displayDeviceobjectA set of Display Device options
sourceMachineImagestringSource machine image
fingerprintstringSpecifies 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.
startRestrictedboolean[Output Only] Whether a VM has been restricted for start because Compute Engine has detected suspicious activity.
statusstring[Output Only] The status of the instance. One of the following values: PROVISIONING, STAGING, RUNNING, STOPPING, SUSPENDING, SUSPENDED, REPAIRING, and TERMINATED. For more information about the status of the instance, see Instance life cycle.
shieldedInstanceIntegrityPolicyobjectThe policy describes the baseline against which Instance boot integrity is measured.
instanceEncryptionKeyobject
reservationAffinityobjectSpecifies the reservations that this instance can consume from.
selfLinkstring[Output Only] Server-defined URL for this resource.
creationTimestampstring[Output Only] Creation timestamp in RFC3339 text format.
shieldedInstanceConfigobjectA set of Shielded Instance options.
lastSuspendedTimestampstring[Output Only] Last suspended timestamp in RFC3339 text format.
paramsobjectAdditional instance params.
serviceAccountsarrayA 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. See Service Accounts for more information.
networkPerformanceConfigobject
labelFingerprintstringA 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.
disksarrayArray of disks associated with this instance. Persistent disks must be created before you can assign them.
schedulingobjectSets the scheduling options for an Instance.
lastStartTimestampstring[Output Only] Last start timestamp in RFC3339 text format.
metadataobjectA metadata key/value entry.
confidentialInstanceConfigobjectA set of Confidential Instance options.
advancedMachineFeaturesobjectSpecifies options for controlling advanced machine features. Options that would traditionally be configured in a BIOS belong here. Features that require operating system support may have corresponding entries in the GuestOsFeatures of an Image (e.g., whether or not the OS in the Image supports nested virtualization being enabled or disabled).
hostnamestringSpecifies 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.
resourceStatusobjectContains output only fields. Use this sub-message for actual values set on Instance attributes as compared to the value requested by the user (intent) in their instance CRUD calls.
statusMessagestring[Output Only] An optional, human-readable explanation of the status.
deletionProtectionbooleanWhether the resource should be protected against deletion.
kindstring[Output Only] Type of the resource. Always compute#instance for instances.
tagsobjectA set of instance tags.
machineTypestringFull 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 a custom 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 the Specifications for custom machine types.
cpuPlatformstring[Output Only] The CPU platform used by this instance.
canIpForwardbooleanAllows 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, see Enabling IP Forwarding .
keyRevocationActionTypestringKeyRevocationActionType of the instance. Supported options are "STOP" and "NONE". The default value is "NONE" if it is not specified.
zonestring[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.
sourceMachineImageEncryptionKeyobject
lastStopTimestampstring[Output Only] Last stop timestamp in RFC3339 text format.
minCpuPlatformstringSpecifies a minimum 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".
guestAcceleratorsarrayA list of the type and count of accelerator cards attached to the instance.
privateIpv6GoogleAccessstringThe private IPv6 google access type for the VM. If not specified, use INHERIT_FROM_SUBNETWORK as default.
labelsobjectLabels to apply to this instance. These can be later modified by the setLabels method.
satisfiesPzsboolean[Output Only] Reserved for future use.

Methods

NameAccessible byRequired ParamsDescription
aggregated_listSELECTprojectRetrieves 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.
getSELECTinstance, project, zoneReturns the specified Instance resource.
listSELECTproject, zoneRetrieves the list of instances contained within the specified zone.
insertINSERTproject, zoneCreates an instance resource in the specified project using the data included in the request.
deleteDELETEinstance, project, zoneDeletes the specified Instance resource. For more information, see Deleting an instance.
_aggregated_listEXECprojectRetrieves 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.
attach_diskEXECinstance, project, zoneAttaches 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, read Adding a persistent disk to your instance.
bulk_insertEXECproject, zoneCreates multiple instances. Count specifies the number of instances to create. For more information, see About bulk creation of VMs.
detach_diskEXECdeviceName, instance, project, zoneDetaches a disk from an instance.
resetEXECinstance, project, zonePerforms a reset on the instance. This is a hard reset. The VM does not do a graceful shutdown. For more information, see Resetting an instance.
resumeEXECinstance, project, zoneResumes an instance that was suspended using the instances().suspend method.
send_diagnostic_interruptEXECinstance, project, zoneSends diagnostic interrupt to the instance.
set_deletion_protectionEXECproject, resource, zoneSets deletion protection on the instance.
set_disk_auto_deleteEXECautoDelete, deviceName, instance, project, zoneSets the auto-delete flag for a disk attached to an instance.
set_labelsEXECinstance, project, zoneSets labels on an instance. To learn more about labels, read the Labeling Resources documentation.
set_machine_resourcesEXECinstance, project, zoneChanges the number and/or type of accelerator for a stopped instance to the values specified in the request.
set_machine_typeEXECinstance, project, zoneChanges the machine type for a stopped instance to the machine type specified in the request.
set_metadataEXECinstance, project, zoneSets metadata for the specified instance to the data included in the request.
set_min_cpu_platformEXECinstance, project, zoneChanges the minimum CPU platform that this instance should use. This method can only be called on a stopped instance. For more information, read Specifying a Minimum CPU Platform.
set_nameEXECinstance, project, zoneSets name of an instance.
set_schedulingEXECinstance, project, zoneSets an instance's scheduling options. You can only call this method on a stopped instance, that is, a VM instance that is in a TERMINATED state. See Instance Life Cycle for more information on the possible instance states. For more information about setting scheduling options for a VM, see Set VM host maintenance policy.
set_service_accountEXECinstance, project, zoneSets the service account on the instance. For more information, read Changing the service account and access scopes for an instance.
set_shielded_instance_integrity_policyEXECinstance, project, zoneSets 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.
set_tagsEXECinstance, project, zoneSets network tags for the specified instance to the data included in the request.
simulate_maintenance_eventEXECinstance, project, zoneSimulates a host maintenance event on a VM. For more information, see Simulate a host maintenance event.
startEXECinstance, project, zoneStarts an instance that was stopped using the instances().stop method. For more information, see Restart an instance.
start_with_encryption_keyEXECinstance, project, zoneStarts an instance that was stopped using the instances().stop method. For more information, see Restart an instance.
stopEXECinstance, project, zoneStops 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, see Stopping an instance.
suspendEXECinstance, project, zoneThis 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.
updateEXECinstance, project, zoneUpdates 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.