Class Instance (1.11.0)

Instance(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Represents an Instance resource. An instance is a virtual machine that is hosted on Google Cloud Platform. For more information, read Virtual Machine Instances.

.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields

Attributes

NameDescription
advanced_machine_features google.cloud.compute_v1.types.AdvancedMachineFeatures
Controls for advanced machine-related behavior features. This field is a member of oneof_ _advanced_machine_features.
can_ip_forward bool
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, see Enabling IP Forwarding . This field is a member of oneof_ _can_ip_forward.
confidential_instance_config google.cloud.compute_v1.types.ConfidentialInstanceConfig
This field is a member of oneof_ _confidential_instance_config.
cpu_platform str
[Output Only] The CPU platform used by this instance. This field is a member of oneof_ _cpu_platform.
creation_timestamp str
[Output Only] Creation timestamp in RFC3339 text format. This field is a member of oneof_ _creation_timestamp.
deletion_protection bool
Whether the resource should be protected against deletion. This field is a member of oneof_ _deletion_protection.
description str
An optional description of this resource. Provide this property when you create the resource. This field is a member of oneof_ _description.
disks MutableSequence[google.cloud.compute_v1.types.AttachedDisk]
Array of disks associated with this instance. Persistent disks must be created before you can assign them.
display_device google.cloud.compute_v1.types.DisplayDevice
Enables display device for the instance. This field is a member of oneof_ _display_device.
fingerprint str
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. This field is a member of oneof_ _fingerprint.
guest_accelerators MutableSequence[google.cloud.compute_v1.types.AcceleratorConfig]
A list of the type and count of accelerator cards attached to the instance.
hostname str
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. This field is a member of oneof_ _hostname.
id int
[Output Only] The unique identifier for the resource. This identifier is defined by the server. This field is a member of oneof_ _id.
key_revocation_action_type str
KeyRevocationActionType of the instance. Supported options are "STOP" and "NONE". The default value is "NONE" if it is not specified. Check the KeyRevocationActionType enum for the list of possible values. This field is a member of oneof_ _key_revocation_action_type.
kind str
[Output Only] Type of the resource. Always compute#instance for instances. This field is a member of oneof_ _kind.
label_fingerprint str
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. This field is a member of oneof_ _label_fingerprint.
labels MutableMapping[str, str]
Labels to apply to this instance. These can be later modified by the setLabels method.
last_start_timestamp str
[Output Only] Last start timestamp in RFC3339 text format. This field is a member of oneof_ _last_start_timestamp.
last_stop_timestamp str
[Output Only] Last stop timestamp in RFC3339 text format. This field is a member of oneof_ _last_stop_timestamp.
last_suspended_timestamp str
[Output Only] Last suspended timestamp in RFC3339 text format. This field is a member of oneof_ _last_suspended_timestamp.
machine_type str
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 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. This field is a member of oneof_ _machine_type.
metadata google.cloud.compute_v1.types.Metadata
The metadata key/value pairs assigned to this instance. This includes custom metadata and predefined keys. This field is a member of oneof_ _metadata.
min_cpu_platform str
Specifies 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". This field is a member of oneof_ _min_cpu_platform.
name str
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 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. This field is a member of oneof_ _name.
network_interfaces MutableSequence[google.cloud.compute_v1.types.NetworkInterface]
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.
network_performance_config google.cloud.compute_v1.types.NetworkPerformanceConfig
This field is a member of oneof_ _network_performance_config.
params google.cloud.compute_v1.types.InstanceParams
Input only. [Input Only] Additional params passed with the request, but not persisted as part of resource payload. This field is a member of oneof_ _params.
private_ipv6_google_access str
The private IPv6 google access type for the VM. If not specified, use INHERIT_FROM_SUBNETWORK as default. Check the PrivateIpv6GoogleAccess enum for the list of possible values. This field is a member of oneof_ _private_ipv6_google_access.
reservation_affinity google.cloud.compute_v1.types.ReservationAffinity
Specifies the reservations that this instance can consume from. This field is a member of oneof_ _reservation_affinity.
resource_policies MutableSequence[str]
Resource policies applied to this instance.
resource_status google.cloud.compute_v1.types.ResourceStatus
[Output Only] Specifies values set for instance attributes as compared to the values requested by user in the corresponding input only field. This field is a member of oneof_ _resource_status.
satisfies_pzs bool
[Output Only] Reserved for future use. This field is a member of oneof_ _satisfies_pzs.
scheduling google.cloud.compute_v1.types.Scheduling
Sets the scheduling options for this instance. This field is a member of oneof_ _scheduling.
self_link str
[Output Only] Server-defined URL for this resource. This field is a member of oneof_ _self_link.
service_accounts MutableSequence[google.cloud.compute_v1.types.ServiceAccount]
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. See Service Accounts for more information.
shielded_instance_config google.cloud.compute_v1.types.ShieldedInstanceConfig
This field is a member of oneof_ _shielded_instance_config.
shielded_instance_integrity_policy google.cloud.compute_v1.types.ShieldedInstanceIntegrityPolicy
This field is a member of oneof_ _shielded_instance_integrity_policy.
source_machine_image str
Source machine image This field is a member of oneof_ _source_machine_image.
source_machine_image_encryption_key google.cloud.compute_v1.types.CustomerEncryptionKey
Source machine image encryption key when creating an instance from a machine image. This field is a member of oneof_ _source_machine_image_encryption_key.
start_restricted bool
[Output Only] Whether a VM has been restricted for start because Compute Engine has detected suspicious activity. This field is a member of oneof_ _start_restricted.
status str
[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. Check the Status enum for the list of possible values. This field is a member of oneof_ _status.
status_message str
[Output Only] An optional, human-readable explanation of the status. This field is a member of oneof_ _status_message.
tags google.cloud.compute_v1.types.Tags
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 with RFC1035. Multiple tags can be specified via the 'tags.items' field. This field is a member of oneof_ _tags.
zone str
[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. This field is a member of oneof_ _zone.

Classes

KeyRevocationActionType

KeyRevocationActionType(value)

KeyRevocationActionType of the instance. Supported options are "STOP" and "NONE". The default value is "NONE" if it is not specified.

Values: UNDEFINED_KEY_REVOCATION_ACTION_TYPE (0): A value indicating that the enum field is not set. KEY_REVOCATION_ACTION_TYPE_UNSPECIFIED (467110106): Default value. This value is unused. NONE (2402104): Indicates user chose no operation. STOP (2555906): Indicates user chose to opt for VM shutdown on key revocation.

LabelsEntry

LabelsEntry(mapping=None, *, ignore_unknown_fields=False, **kwargs)

The abstract base class for a message.

Parameters
NameDescription
kwargs dict

Keys and values corresponding to the fields of the message.

mapping Union[dict, .Message]

A dictionary or message to be used to determine the values for this message.

ignore_unknown_fields Optional(bool)

If True, do not raise errors for unknown fields. Only applied if mapping is a mapping type or there are keyword parameters.

PrivateIpv6GoogleAccess

PrivateIpv6GoogleAccess(value)

The private IPv6 google access type for the VM. If not specified, use INHERIT_FROM_SUBNETWORK as default.

Values: UNDEFINED_PRIVATE_IPV6_GOOGLE_ACCESS (0): A value indicating that the enum field is not set. ENABLE_BIDIRECTIONAL_ACCESS_TO_GOOGLE (427975994): Bidirectional private IPv6 access to/from Google services. If specified, the subnetwork who is attached to the instance's default network interface will be assigned an internal IPv6 prefix if it doesn't have before. ENABLE_OUTBOUND_VM_ACCESS_TO_GOOGLE (288210263): Outbound private IPv6 access from VMs in this subnet to Google services. If specified, the subnetwork who is attached to the instance's default network interface will be assigned an internal IPv6 prefix if it doesn't have before. INHERIT_FROM_SUBNETWORK (530256959): Each network interface inherits PrivateIpv6GoogleAccess from its subnetwork.

Status

Status(value)

[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.

Values: UNDEFINED_STATUS (0): A value indicating that the enum field is not set. DEPROVISIONING (428935662): The Nanny is halted and we are performing tear down tasks like network deprogramming, releasing quota, IP, tearing down disks etc. PROVISIONING (290896621): Resources are being allocated for the instance. REPAIRING (413483285): The instance is in repair. RUNNING (121282975): The instance is running. STAGING (431072283): All required resources have been allocated and the instance is being started. STOPPED (444276141): The instance has stopped successfully. STOPPING (350791796): The instance is currently stopping (either being deleted or killed). SUSPENDED (51223995): The instance has suspended. SUSPENDING (514206246): The instance is suspending. TERMINATED (250018339): The instance has stopped (either by explicit action or underlying failure).