Skip to main content

instance_groups

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

Overview​

Nameinstance_groups
TypeResource
Idgoogle.compute.instance_groups

Fields​

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstring (uint64)Output only. [Output Only] A unique identifier for this instance group, generated by the server.
namestringThe name of the instance group. The name must be 1-63 characters long, and comply withRFC1035. (pattern: [a-z](?:[-a-z0-9]{0,61}[a-z0-9])?)
creationTimestampstringOutput only. [Output Only] The creation timestamp for this instance group inRFC3339 text format.
descriptionstringAn optional description of this resource. Provide this property when you create the resource.
fingerprintstring (byte)Output only. [Output Only] The fingerprint of the named ports. The system uses this fingerprint to detect conflicts when multiple users change the named ports concurrently.
kindstringOutput only. [Output Only] The resource type, which is alwayscompute#instanceGroup for instance groups. (default: compute#instanceGroup)
namedPortsarrayOptional. Assigns a name to a port number. For example:{name: "http", port: 80} This allows the system to reference ports by the assigned name instead of a port number. Named ports can also contain multiple ports. For example:[{name: "app1", port: 8080}, {name: "app1", port: 8081}, {name: "app2", port: 8082}] Named ports apply to all instances in this instance group.
networkstring[Output Only] The URL of the network to which all instances in the instance group belong. If your instance has multiple network interfaces, then the network and subnetwork fields only refer to the network and subnet used by your primary interface (nic0).
regionstringOutput only. [Output Only] The URL of theregion where the instance group is located (for regional resources).
selfLinkstringOutput only. [Output Only] The URL for this instance group. The server generates this URL.
sizeinteger (int32)Output only. [Output Only] The total number of instances in the instance group.
subnetworkstringOutput only. [Output Only] The URL of the subnetwork to which all instances in the instance group belong. If your instance has multiple network interfaces, then the network and subnetwork fields only refer to the network and subnet used by your primary interface (nic0).
zonestringOutput only. [Output Only] The URL of thezone where the instance group is located (for zonal resources).

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectproject, zone, instanceGroupReturns the specified zonal instance group. Get a list of available zonal
instance groups by making a list() request.

For managed instance groups, use theinstanceGroupManagers
or regionInstanceGroupManagers
methods instead.
listselectproject, zonefilter, maxResults, orderBy, pageToken, returnPartialSuccessRetrieves the list of zonal instance group resources contained within the
specified zone.

For managed instance groups, use theinstanceGroupManagers
or regionInstanceGroupManagers
methods instead.
aggregated_listselectprojectfilter, includeAllScopes, maxResults, orderBy, pageToken, returnPartialSuccess, serviceProjectNumberRetrieves the list of instance groups and sorts them by zone.

To prevent failure, Google recommends that you set the
returnPartialSuccess parameter to true.
insertinsertproject, zonerequestIdCreates an instance group in the specified project using the
parameters that are included in the request.
deletedeleteproject, zone, instanceGrouprequestIdDeletes the specified instance group. The instances in the group are not
deleted. Note that instance group must not belong to a backend service.
Read
Deleting an instance group for more information.
set_named_portsexecproject, zone, instanceGrouprequestIdSets the named ports for the specified instance group.

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
includeAllScopesboolean
maxResultsinteger (uint32)
orderBystring
pageTokenstring
requestIdstring
returnPartialSuccessboolean
serviceProjectNumberstring (int64)

SELECT examples​

Returns the specified zonal instance group. Get a list of available zonal
instance groups by making a list() request.

For managed instance groups, use theinstanceGroupManagers
or regionInstanceGroupManagers
methods instead.

SELECT
id,
name,
creationTimestamp,
description,
fingerprint,
kind,
namedPorts,
network,
region,
selfLink,
size,
subnetwork,
zone
FROM google.compute.instance_groups
WHERE project = '{{ project }}' -- required
AND zone = '{{ zone }}' -- required
AND instanceGroup = '{{ instanceGroup }}' -- required
;

INSERT examples​

Creates an instance group in the specified project using the
parameters that are included in the request.

INSERT INTO google.compute.instance_groups (
data__description,
data__name,
data__namedPorts,
data__network,
project,
zone,
requestId
)
SELECT
'{{ description }}',
'{{ name }}',
'{{ namedPorts }}',
'{{ network }}',
'{{ project }}',
'{{ zone }}',
'{{ 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​

Deletes the specified instance group. The instances in the group are not
deleted. Note that instance group must not belong to a backend service.
Read
Deleting an instance group for more information.

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

Lifecycle Methods​

Sets the named ports for the specified instance group.

EXEC google.compute.instance_groups.set_named_ports
@project='{{ project }}' --required,
@zone='{{ zone }}' --required,
@instanceGroup='{{ instanceGroup }}' --required,
@requestId='{{ requestId }}'
@@json=
'{
"fingerprint": "{{ fingerprint }}",
"namedPorts": "{{ namedPorts }}"
}'
;