Skip to main content

instance_groups_instances

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

Overview​

Nameinstance_groups_instances
TypeResource
Idgoogle.compute.instance_groups_instances

Fields​

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringOutput only. [Output Only] Unique identifier for the resource; defined by the server.
itemsarrayA list of InstanceWithNamedPorts resources.
kindstringOutput only. [Output Only] The resource type, which is alwayscompute#instanceGroupsListInstances for the list of instances in the specified instance group. (default: compute#instanceGroupsListInstances)
nextPageTokenstringOutput only. [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.
selfLinkstringOutput only. [Output Only] Server-defined URL for this resource.
warningobjectOutput only. [Output Only] Informational warning message.

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_instancesselectproject, zone, instanceGroupfilter, maxResults, orderBy, pageToken, returnPartialSuccessLists the instances in the specified instance group.
The orderBy query parameter is not supported.
The filter query parameter is supported, but only for
expressions that use eq (equal) or ne (not equal) operators.
add_instancesinsertproject, zone, instanceGrouprequestIdAdds a list of instances to the specified instance group. All of the
instances in the instance group must be in the same network/subnetwork.
Read
Adding instances for more information.
remove_instancesdeleteproject, zone, instanceGrouprequestIdRemoves one or more instances from the specified instance group, but does
not delete those instances.

If the group is part of a backend
service that has enabled
connection draining, it can take up to 60 seconds after the connection
draining duration before the VM instance is removed or deleted.

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
instanceGroupstring
projectstring
zonestring
filterstring
maxResultsinteger (uint32)
orderBystring
pageTokenstring
requestIdstring
returnPartialSuccessboolean

SELECT examples​

Lists the instances in the specified instance group.
The orderBy query parameter is not supported.
The filter query parameter is supported, but only for
expressions that use eq (equal) or ne (not equal) operators.

SELECT
id,
items,
kind,
nextPageToken,
selfLink,
warning
FROM google.compute.instance_groups_instances
WHERE project = '{{ project }}' -- required
AND zone = '{{ zone }}' -- required
AND instanceGroup = '{{ instanceGroup }}' -- required
AND filter = '{{ filter }}'
AND maxResults = '{{ maxResults }}'
AND orderBy = '{{ orderBy }}'
AND pageToken = '{{ pageToken }}'
AND returnPartialSuccess = '{{ returnPartialSuccess }}'
;

INSERT examples​

Adds a list of instances to the specified instance group. All of the
instances in the instance group must be in the same network/subnetwork.
Read
Adding instances for more information.

INSERT INTO google.compute.instance_groups_instances (
data__instances,
project,
zone,
instanceGroup,
requestId
)
SELECT
'{{ instances }}',
'{{ project }}',
'{{ zone }}',
'{{ instanceGroup }}',
'{{ 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
;

DELETE examples​

Removes one or more instances from the specified instance group, but does
not delete those instances.

If the group is part of a backend
service that has enabled
connection draining, it can take up to 60 seconds after the connection
draining duration before the VM instance is removed or deleted.

DELETE FROM google.compute.instance_groups_instances
WHERE project = '{{ project }}' --required
AND zone = '{{ zone }}' --required
AND instanceGroup = '{{ instanceGroup }}' --required
AND requestId = '{{ requestId }}'
;