instance_groups
Creates, updates, deletes, gets or lists an instance_groups resource.
Overview
| Name | instance_groups |
| Type | Resource |
| Id | google.compute.instance_groups |
Fields
The following fields are returned by SELECT queries:
- get
- list
- aggregated_list
| Name | Datatype | Description |
|---|---|---|
id | string (uint64) | Output only. [Output Only] A unique identifier for this instance group, generated by the server. |
name | string | The 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])?) |
creationTimestamp | string | Output only. [Output Only] The creation timestamp for this instance group inRFC3339 text format. |
description | string | An optional description of this resource. Provide this property when you create the resource. |
fingerprint | string (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. |
kind | string | Output only. [Output Only] The resource type, which is alwayscompute#instanceGroup for instance groups. (default: compute#instanceGroup) |
namedPorts | array | Optional. 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. |
network | string | [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). |
region | string | Output only. [Output Only] The URL of theregion where the instance group is located (for regional resources). |
selfLink | string | Output only. [Output Only] The URL for this instance group. The server generates this URL. |
size | integer (int32) | Output only. [Output Only] The total number of instances in the instance group. |
subnetwork | string | Output 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). |
zone | string | Output only. [Output Only] The URL of thezone where the instance group is located (for zonal resources). |
| Name | Datatype | Description |
|---|---|---|
id | string | Output only. [Output Only] Unique identifier for the resource; defined by the server. |
items | array | A list of InstanceGroup resources. |
kind | string | Output only. The resource type. (default: compute#regionInstanceGroupList) |
nextPageToken | string | Output 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. |
selfLink | string | Output only. [Output Only] Server-defined URL for this resource. |
warning | object | Output only. [Output Only] Informational warning message. |
| Name | Datatype | Description |
|---|---|---|
id | string (uint64) | Output only. [Output Only] A unique identifier for this instance group, generated by the server. |
name | string | The 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])?) |
creationTimestamp | string | Output only. [Output Only] The creation timestamp for this instance group inRFC3339 text format. |
description | string | An optional description of this resource. Provide this property when you create the resource. |
fingerprint | string (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. |
kind | string | Output only. [Output Only] The resource type, which is alwayscompute#instanceGroup for instance groups. (default: compute#instanceGroup) |
namedPorts | array | Optional. 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. |
network | string | [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). |
region | string | Output only. [Output Only] The URL of theregion where the instance group is located (for regional resources). |
selfLink | string | Output only. [Output Only] The URL for this instance group. The server generates this URL. |
size | integer (int32) | Output only. [Output Only] The total number of instances in the instance group. |
subnetwork | string | Output 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). |
zone | string | Output 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:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | project, region, instanceGroup | Returns the specified instance group resource. | |
list | select | project, region | returnPartialSuccess, orderBy, maxResults, pageToken, filter | Retrieves the list of instance group resources contained within the specified region. |
aggregated_list | select | project | returnPartialSuccess, includeAllScopes, orderBy, maxResults, pageToken, filter, serviceProjectNumber | Retrieves the list of instance groups and sorts them by zone. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true. |
insert | insert | project, zone | requestId | Creates an instance group in the specified project using the parameters that are included in the request. |
delete | delete | project, zone, instanceGroup | requestId | 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. |
set_named_ports | exec | project, region, instanceGroup | requestId | Sets the named ports for the specified regional 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.
| Name | Datatype | Description |
|---|---|---|
instanceGroup | string | |
project | string | |
region | string | |
zone | string | |
filter | string | |
includeAllScopes | boolean | |
maxResults | integer (uint32) | |
orderBy | string | |
pageToken | string | |
requestId | string | |
returnPartialSuccess | boolean | |
serviceProjectNumber | string (int64) |
SELECT examples
- get
- list
- aggregated_list
Returns the specified instance group resource.
SELECT
id,
name,
creationTimestamp,
description,
fingerprint,
kind,
namedPorts,
network,
region,
selfLink,
size,
subnetwork,
zone
FROM google.compute.instance_groups
WHERE project = '{{ project }}' -- required
AND region = '{{ region }}' -- required
AND instanceGroup = '{{ instanceGroup }}' -- required
;
Retrieves the list of instance group resources contained within
the specified region.
SELECT
id,
items,
kind,
nextPageToken,
selfLink,
warning
FROM google.compute.instance_groups
WHERE project = '{{ project }}' -- required
AND region = '{{ region }}' -- required
AND returnPartialSuccess = '{{ returnPartialSuccess }}'
AND orderBy = '{{ orderBy }}'
AND maxResults = '{{ maxResults }}'
AND pageToken = '{{ pageToken }}'
AND filter = '{{ filter }}'
;
Retrieves the list of instance groups and sorts them by zone.
To prevent failure, Google recommends that you set thereturnPartialSuccess parameter to true.
SELECT
id,
name,
creationTimestamp,
description,
fingerprint,
kind,
namedPorts,
network,
region,
selfLink,
size,
subnetwork,
zone
FROM google.compute.instance_groups
WHERE project = '{{ project }}' -- required
AND returnPartialSuccess = '{{ returnPartialSuccess }}'
AND includeAllScopes = '{{ includeAllScopes }}'
AND orderBy = '{{ orderBy }}'
AND maxResults = '{{ maxResults }}'
AND pageToken = '{{ pageToken }}'
AND filter = '{{ filter }}'
AND serviceProjectNumber = '{{ serviceProjectNumber }}'
;
INSERT examples
- insert
- Manifest
Creates an instance group in the specified project using the
parameters that are included in the request.
INSERT INTO google.compute.instance_groups (
data__network,
data__description,
data__namedPorts,
data__name,
project,
zone,
requestId
)
SELECT
'{{ network }}',
'{{ description }}',
'{{ namedPorts }}',
'{{ name }}',
'{{ 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
;
# Description fields are for documentation purposes
- name: instance_groups
props:
- name: project
value: "{{ project }}"
description: Required parameter for the instance_groups resource.
- name: zone
value: "{{ zone }}"
description: Required parameter for the instance_groups resource.
- name: network
value: "{{ network }}"
description: |
[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).
- name: description
value: "{{ description }}"
description: |
An optional description of this resource. Provide this property when you
create the resource.
- name: namedPorts
description: |
Optional. 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.
value:
- port: {{ port }}
name: "{{ name }}"
- name: name
value: "{{ name }}"
description: |
The name of the instance group. The name must be 1-63 characters
long, and comply withRFC1035.
- name: requestId
value: "{{ requestId }}"
DELETE examples
- delete
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
- set_named_ports
Sets the named ports for the specified regional instance group.
EXEC google.compute.instance_groups.set_named_ports
@project='{{ project }}' --required,
@region='{{ region }}' --required,
@instanceGroup='{{ instanceGroup }}' --required,
@requestId='{{ requestId }}'
@@json=
'{
"namedPorts": "{{ namedPorts }}",
"fingerprint": "{{ fingerprint }}"
}'
;