instance_group_managers
Creates, updates, deletes, gets or lists an instance_group_managers resource.
Overview
| Name | instance_group_managers |
| Type | Resource |
| Id | google.compute.instance_group_managers |
Fields
The following fields are returned by SELECT queries:
- get
- list
- aggregated_list
| Name | Datatype | Description |
|---|---|---|
id | string (uint64) | Output only. A unique identifier for this resource type. The server generates this identifier. |
name | string | The name of the managed instance group. The name must be 1-63 characters long, and comply withRFC1035. (pattern: [a-z](?:[-a-z0-9]{0,61}[a-z0-9])?) |
allInstancesConfig | object | Specifies configuration that overrides the instance template configuration for the group. (id: InstanceGroupManagerAllInstancesConfig) |
autoHealingPolicies | array | The autohealing policy for this managed instance group. You can specify only one value. |
baseInstanceName | string | The base instance name is a prefix that you want to attach to the names of all VMs in a MIG. The maximum character length is 58 and the name must comply with RFC1035 format. When a VM is created in the group, the MIG appends a hyphen and a random four-character string to the base instance name. If you want the MIG to assign sequential numbers instead of a random string, then end the base instance name with a hyphen followed by one or more hash symbols. The hash symbols indicate the number of digits. For example, a base instance name of "vm-###" results in "vm-001" as a VM name. @pattern [a-z](([-a-z0-9]{0,57})|([-a-z0-9]{0,51}-#{1,10}(\[[0-9]{1,10}\])?)) |
creationTimestamp | string | Output only. The creation timestamp for this managed instance group inRFC3339 text format. |
currentActions | object | Output only. The list of instance actions and the number of instances in this managed instance group that are scheduled for each of those actions. (id: InstanceGroupManagerActionsSummary) |
description | string | An optional description of this resource. |
distributionPolicy | object | Policy specifying the intended distribution of managed instances across zones in a regional managed instance group. (id: DistributionPolicy) |
fingerprint | string (byte) | Fingerprint of this resource. This field may be used in optimistic locking. It will be ignored when inserting an InstanceGroupManager. An up-to-date fingerprint must be provided in order to update the InstanceGroupManager, otherwise the request will fail with error412 conditionNotMet. To see the latest fingerprint, make a get() request to retrieve an InstanceGroupManager. |
instanceFlexibilityPolicy | object | Instance flexibility allowing MIG to create VMs from multiple types of machines. Instance flexibility configuration on MIG overrides instance template configuration. (id: InstanceGroupManagerInstanceFlexibilityPolicy) |
instanceGroup | string | Output only. The URL of the Instance Group resource. |
instanceLifecyclePolicy | object | The repair policy for this managed instance group. (id: InstanceGroupManagerInstanceLifecyclePolicy) |
instanceTemplate | string | The URL of the instance template that is specified for this managed instance group. The group uses this template to create all new instances in the managed instance group. The templates for existing instances in the group do not change unless you run recreateInstances, runapplyUpdatesToInstances, or set the group'supdatePolicy.type to PROACTIVE. |
kind | string | Output only. The resource type, which is alwayscompute#instanceGroupManager for managed instance groups. (default: compute#instanceGroupManager) |
listManagedInstancesResults | string | Pagination behavior of the listManagedInstances API method for this managed instance group. (PAGELESS, PAGINATED) |
namedPorts | array | [Output Only] Named ports configured on the Instance Groups complementary to this Instance Group Manager. |
region | string | Output only. [Output Only] The URL of theregion where the managed instance group resides (for regional resources). |
resourcePolicies | object | Resource policies for this managed instance group. (id: InstanceGroupManagerResourcePolicies) |
satisfiesPzi | boolean | Output only. Reserved for future use. |
satisfiesPzs | boolean | Output only. Reserved for future use. |
selfLink | string | Output only. The URL for this managed instance group. The server defines this URL. |
standbyPolicy | object | Standby policy for stopped and suspended instances. (id: InstanceGroupManagerStandbyPolicy) |
statefulPolicy | object | Stateful configuration for this Instanced Group Manager (id: StatefulPolicy) |
status | object | Output only. The status of this managed instance group. (id: InstanceGroupManagerStatus) |
targetPools | array | The URLs for all TargetPool resources to which instances in theinstanceGroup field are added. The target pools automatically apply to all of the instances in the managed instance group. |
targetSize | integer (int32) | The target number of running instances for this managed instance group. You can reduce this number by using the instanceGroupManager deleteInstances or abandonInstances methods. Resizing the group also changes this number. |
targetSizePolicy | object | The policy that specifies how the MIG creates its VMs to achieve the target size. (id: InstanceGroupManagerTargetSizePolicy) |
targetStoppedSize | integer (int32) | The target number of stopped instances for this managed instance group. This number changes when you: - Stop instance using the stopInstances method or start instances using the startInstances method. - Manually change the targetStoppedSize using the update method. |
targetSuspendedSize | integer (int32) | The target number of suspended instances for this managed instance group. This number changes when you: - Suspend instance using the suspendInstances method or resume instances using the resumeInstances method. - Manually change the targetSuspendedSize using the update method. |
updatePolicy | object | The update policy for this managed instance group. (id: InstanceGroupManagerUpdatePolicy) |
versions | array | Specifies the instance templates used by this managed instance group to create instances. Each version is defined by an instanceTemplate and aname. Every version can appear at most once per instance group. This field overrides the top-level instanceTemplate field. Read more about therelationships between these fields. Exactly one version must leave thetargetSize field unset. That version will be applied to all remaining instances. For more information, read aboutcanary updates. |
zone | string | Output only. The URL of azone where the managed instance group is located (for zonal resources). |
| Name | Datatype | Description |
|---|---|---|
id | string | Output only. Unique identifier for the resource; defined by the server. |
items | array | A list of InstanceGroupManager resources. |
kind | string | Output only. The resource type, which is always compute#instanceGroupManagerList for a list of managed instance groups that exist in th regional scope. (default: compute#regionInstanceGroupManagerList) |
nextPageToken | string | 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. Server-defined URL for this resource. |
warning | object | Output only. Informational warning message. |
| Name | Datatype | Description |
|---|---|---|
id | string (uint64) | Output only. A unique identifier for this resource type. The server generates this identifier. |
name | string | The name of the managed instance group. The name must be 1-63 characters long, and comply withRFC1035. (pattern: [a-z](?:[-a-z0-9]{0,61}[a-z0-9])?) |
allInstancesConfig | object | Specifies configuration that overrides the instance template configuration for the group. (id: InstanceGroupManagerAllInstancesConfig) |
autoHealingPolicies | array | The autohealing policy for this managed instance group. You can specify only one value. |
baseInstanceName | string | The base instance name is a prefix that you want to attach to the names of all VMs in a MIG. The maximum character length is 58 and the name must comply with RFC1035 format. When a VM is created in the group, the MIG appends a hyphen and a random four-character string to the base instance name. If you want the MIG to assign sequential numbers instead of a random string, then end the base instance name with a hyphen followed by one or more hash symbols. The hash symbols indicate the number of digits. For example, a base instance name of "vm-###" results in "vm-001" as a VM name. @pattern [a-z](([-a-z0-9]{0,57})|([-a-z0-9]{0,51}-#{1,10}(\[[0-9]{1,10}\])?)) |
creationTimestamp | string | Output only. The creation timestamp for this managed instance group inRFC3339 text format. |
currentActions | object | Output only. The list of instance actions and the number of instances in this managed instance group that are scheduled for each of those actions. (id: InstanceGroupManagerActionsSummary) |
description | string | An optional description of this resource. |
distributionPolicy | object | Policy specifying the intended distribution of managed instances across zones in a regional managed instance group. (id: DistributionPolicy) |
fingerprint | string (byte) | Fingerprint of this resource. This field may be used in optimistic locking. It will be ignored when inserting an InstanceGroupManager. An up-to-date fingerprint must be provided in order to update the InstanceGroupManager, otherwise the request will fail with error412 conditionNotMet. To see the latest fingerprint, make a get() request to retrieve an InstanceGroupManager. |
instanceFlexibilityPolicy | object | Instance flexibility allowing MIG to create VMs from multiple types of machines. Instance flexibility configuration on MIG overrides instance template configuration. (id: InstanceGroupManagerInstanceFlexibilityPolicy) |
instanceGroup | string | Output only. The URL of the Instance Group resource. |
instanceLifecyclePolicy | object | The repair policy for this managed instance group. (id: InstanceGroupManagerInstanceLifecyclePolicy) |
instanceTemplate | string | The URL of the instance template that is specified for this managed instance group. The group uses this template to create all new instances in the managed instance group. The templates for existing instances in the group do not change unless you run recreateInstances, runapplyUpdatesToInstances, or set the group'supdatePolicy.type to PROACTIVE. |
kind | string | Output only. The resource type, which is alwayscompute#instanceGroupManager for managed instance groups. (default: compute#instanceGroupManager) |
listManagedInstancesResults | string | Pagination behavior of the listManagedInstances API method for this managed instance group. (PAGELESS, PAGINATED) |
namedPorts | array | [Output Only] Named ports configured on the Instance Groups complementary to this Instance Group Manager. |
region | string | Output only. [Output Only] The URL of theregion where the managed instance group resides (for regional resources). |
resourcePolicies | object | Resource policies for this managed instance group. (id: InstanceGroupManagerResourcePolicies) |
satisfiesPzi | boolean | Output only. Reserved for future use. |
satisfiesPzs | boolean | Output only. Reserved for future use. |
selfLink | string | Output only. The URL for this managed instance group. The server defines this URL. |
standbyPolicy | object | Standby policy for stopped and suspended instances. (id: InstanceGroupManagerStandbyPolicy) |
statefulPolicy | object | Stateful configuration for this Instanced Group Manager (id: StatefulPolicy) |
status | object | Output only. The status of this managed instance group. (id: InstanceGroupManagerStatus) |
targetPools | array | The URLs for all TargetPool resources to which instances in theinstanceGroup field are added. The target pools automatically apply to all of the instances in the managed instance group. |
targetSize | integer (int32) | The target number of running instances for this managed instance group. You can reduce this number by using the instanceGroupManager deleteInstances or abandonInstances methods. Resizing the group also changes this number. |
targetSizePolicy | object | The policy that specifies how the MIG creates its VMs to achieve the target size. (id: InstanceGroupManagerTargetSizePolicy) |
targetStoppedSize | integer (int32) | The target number of stopped instances for this managed instance group. This number changes when you: - Stop instance using the stopInstances method or start instances using the startInstances method. - Manually change the targetStoppedSize using the update method. |
targetSuspendedSize | integer (int32) | The target number of suspended instances for this managed instance group. This number changes when you: - Suspend instance using the suspendInstances method or resume instances using the resumeInstances method. - Manually change the targetSuspendedSize using the update method. |
updatePolicy | object | The update policy for this managed instance group. (id: InstanceGroupManagerUpdatePolicy) |
versions | array | Specifies the instance templates used by this managed instance group to create instances. Each version is defined by an instanceTemplate and aname. Every version can appear at most once per instance group. This field overrides the top-level instanceTemplate field. Read more about therelationships between these fields. Exactly one version must leave thetargetSize field unset. That version will be applied to all remaining instances. For more information, read aboutcanary updates. |
zone | string | Output only. The URL of azone where the managed 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, instanceGroupManager | Returns all of the details about the specified managed instance group. | |
list | select | project, region | filter, maxResults, pageToken, orderBy, returnPartialSuccess | Retrieves the list of managed instance groups that are contained within the specified region. |
aggregated_list | select | project | includeAllScopes, orderBy, filter, serviceProjectNumber, maxResults, pageToken, returnPartialSuccess | Retrieves the list of managed instance groups and groups them by zone. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true. |
insert | insert | project, region | requestId | Creates a managed instance group using the information that you specify in the request. After the group is created, instances in the group are created using the specified instance template. This operation is marked as DONE when the group is created even if the instances in the group have not yet been created. You must separately verify the status of the individual instances with thelistmanagedinstances method. A regional managed instance group can contain up to 2000 instances. |
patch | update | project, region, instanceGroupManager | requestId | Updates a managed instance group using the information that you specify in the request. This operation is marked as DONE when the group is patched even if the instances in the group are still in the process of being patched. You must separately verify the status of the individual instances with the listmanagedinstances method. This method supportsPATCH semantics and uses theJSON merge patch format and processing rules. If you update your group to specify a new template or instance configuration, it's possible that your intended specification for each VM in the group is different from the current state of that VM. To learn how to apply an updated configuration to the VMs in a MIG, seeUpdating instances in a MIG. |
patch_per_instance_configs | update | project, region, instanceGroupManager | requestId | Inserts or patches per-instance configurations for the managed instance group. perInstanceConfig.name serves as a key used to distinguish whether to perform insert or patch. |
delete | delete | project, region, instanceGroupManager | noGracefulShutdown, requestId | Deletes the specified managed instance group and all of the instances in that group. |
set_target_pools | exec | project, region, instanceGroupManager | requestId | Modifies the target pools to which all new instances in this group are assigned. Existing instances in the group are not affected. |
set_instance_template | exec | project, region, instanceGroupManager | requestId | Sets the instance template to use when creating new instances or recreating instances in this group. Existing instances are not affected. |
recreate_instances | exec | project, region, instanceGroupManager | noGracefulShutdown, requestId | Flags the specified VM instances in the managed instance group to be immediately recreated. Each instance is recreated using the group's current configuration. This operation is marked as DONE when the flag is set even if the instances have not yet been recreated. You must separately verify the status of each instance by checking itscurrentAction field; for more information, see Checking the status of managed 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 has elapsed before the VM instance is removed or deleted. You can specify a maximum of 1000 instances with this method per request. |
stop_instances | exec | project, region, instanceGroupManager | noGracefulShutdown, requestId | Flags the specified instances in the managed instance group to be immediately stopped. You can only specify instances that are running in this request. This method reduces thetargetSize and increases the targetStoppedSize of the managed instance group by the number of instances that you stop. The stopInstances operation is marked DONE if the stopInstances request is successful. The underlying actions take additional time. You must separately verify the status of theSTOPPING action with thelistmanagedinstances method. If the standbyPolicy.initialDelaySec field is set, the group delays stopping the instances until initialDelaySec have passed from instance.creationTimestamp (that is, when the instance was created). This delay gives your application time to set itself up and initialize on the instance. If more thaninitialDelaySec seconds have passed sinceinstance.creationTimestamp when this method is called, there will be zero delay. 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 has elapsed before the VM instance is stopped. Stopped instances can be started using the startInstances method. You can specify a maximum of 1000 instances with this method per request. |
start_instances | exec | project, region, instanceGroupManager | requestId | Flags the specified instances in the managed instance group to be started. This method increases thetargetSize and decreases the targetStoppedSize of the managed instance group by the number of instances that you start. The startInstances operation is marked DONE if the startInstances request is successful. The underlying actions take additional time. You must separately verify the status of theSTARTING action with thelistmanagedinstances method. In this request, you can only specify instances that are stopped. For example, if an instance was previously stopped using the stopInstances method, it can be started using the startInstances method. If a health check is attached to the managed instance group, the specified instances will be verified as healthy after they are started. You can specify a maximum of 1000 instances with this method per request. |
apply_updates_to_instances | exec | project, region, instanceGroupManager | Apply updates to selected instances the managed instance group. | |
resize | exec | project, region, instanceGroupManager, size | requestId | Changes the intended size of the managed instance group. If you increase the size, the group creates new instances using the current instance template. If you decrease the size, the group deletes one or more instances. The resize operation is marked DONE if theresize request is successful. The underlying actions take additional time. You must separately verify the status of thecreating or deleting actions with thelistmanagedinstances method. 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 has elapsed before the VM instance is removed or deleted. |
abandon_instances | exec | project, region, instanceGroupManager | requestId | Flags the specified instances to be immediately removed from the managed instance group. Abandoning an instance does not delete the instance, but it does remove the instance from any target pools that are applied by the managed instance group. This method reduces thetargetSize of the managed instance group by the number of instances that you abandon. This operation is marked asDONE when the action is scheduled even if the instances have not yet been removed from the group. You must separately verify the status of the abandoning action with thelistmanagedinstances method. 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 has elapsed before the VM instance is removed or deleted. You can specify a maximum of 1000 instances with this method per request. |
suspend_instances | exec | project, region, instanceGroupManager | requestId | Flags the specified instances in the managed instance group to be immediately suspended. You can only specify instances that are running in this request. This method reduces thetargetSize and increases the targetSuspendedSize of the managed instance group by the number of instances that you suspend. The suspendInstances operation is marked DONE if the suspendInstances request is successful. The underlying actions take additional time. You must separately verify the status of theSUSPENDING action with thelistmanagedinstances method. If the standbyPolicy.initialDelaySec field is set, the group delays suspension of the instances until initialDelaySec have passed from instance.creationTimestamp (that is, when the instance was created). This delay gives your application time to set itself up and initialize on the instance. If more thaninitialDelaySec seconds have passed sinceinstance.creationTimestamp when this method is called, there will be zero delay. 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 has elapsed before the VM instance is suspended. Suspended instances can be resumed using the resumeInstances method. You can specify a maximum of 1000 instances with this method per request. |
resume_instances | exec | project, region, instanceGroupManager | requestId | Flags the specified instances in the managed instance group to be resumed. This method increases thetargetSize and decreases the targetSuspendedSize of the managed instance group by the number of instances that you resume. The resumeInstances operation is marked DONE if the resumeInstances request is successful. The underlying actions take additional time. You must separately verify the status of theRESUMING action with thelistmanagedinstances method. In this request, you can only specify instances that are suspended. For example, if an instance was previously suspended using the suspendInstances method, it can be resumed using the resumeInstances method. If a health check is attached to the managed instance group, the specified instances will be verified as healthy after they are resumed. You can specify a maximum of 1000 instances with this method per request. |
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 |
|---|---|---|
instanceGroupManager | string | |
project | string | |
region | string | |
size | integer (int32) | |
filter | string | |
includeAllScopes | boolean | |
maxResults | integer (uint32) | |
noGracefulShutdown | boolean | |
orderBy | string | |
pageToken | string | |
requestId | string | |
returnPartialSuccess | boolean | |
serviceProjectNumber | string (int64) |
SELECT examples
- get
- list
- aggregated_list
Returns all of the details about the specified managed instance group.
SELECT
id,
name,
allInstancesConfig,
autoHealingPolicies,
baseInstanceName,
creationTimestamp,
currentActions,
description,
distributionPolicy,
fingerprint,
instanceFlexibilityPolicy,
instanceGroup,
instanceLifecyclePolicy,
instanceTemplate,
kind,
listManagedInstancesResults,
namedPorts,
region,
resourcePolicies,
satisfiesPzi,
satisfiesPzs,
selfLink,
standbyPolicy,
statefulPolicy,
status,
targetPools,
targetSize,
targetSizePolicy,
targetStoppedSize,
targetSuspendedSize,
updatePolicy,
versions,
zone
FROM google.compute.instance_group_managers
WHERE project = '{{ project }}' -- required
AND region = '{{ region }}' -- required
AND instanceGroupManager = '{{ instanceGroupManager }}' -- required
;
Retrieves the list of managed instance groups that are contained
within the specified region.
SELECT
id,
items,
kind,
nextPageToken,
selfLink,
warning
FROM google.compute.instance_group_managers
WHERE project = '{{ project }}' -- required
AND region = '{{ region }}' -- required
AND filter = '{{ filter }}'
AND maxResults = '{{ maxResults }}'
AND pageToken = '{{ pageToken }}'
AND orderBy = '{{ orderBy }}'
AND returnPartialSuccess = '{{ returnPartialSuccess }}'
;
Retrieves the list of managed instance groups and groups them by zone.
To prevent failure, Google recommends that you set thereturnPartialSuccess parameter to true.
SELECT
id,
name,
allInstancesConfig,
autoHealingPolicies,
baseInstanceName,
creationTimestamp,
currentActions,
description,
distributionPolicy,
fingerprint,
instanceFlexibilityPolicy,
instanceGroup,
instanceLifecyclePolicy,
instanceTemplate,
kind,
listManagedInstancesResults,
namedPorts,
region,
resourcePolicies,
satisfiesPzi,
satisfiesPzs,
selfLink,
standbyPolicy,
statefulPolicy,
status,
targetPools,
targetSize,
targetSizePolicy,
targetStoppedSize,
targetSuspendedSize,
updatePolicy,
versions,
zone
FROM google.compute.instance_group_managers
WHERE project = '{{ project }}' -- required
AND includeAllScopes = '{{ includeAllScopes }}'
AND orderBy = '{{ orderBy }}'
AND filter = '{{ filter }}'
AND serviceProjectNumber = '{{ serviceProjectNumber }}'
AND maxResults = '{{ maxResults }}'
AND pageToken = '{{ pageToken }}'
AND returnPartialSuccess = '{{ returnPartialSuccess }}'
;
INSERT examples
- insert
- Manifest
Creates a managed instance group using the information that you specify
in the request. After the group is created, instances in the group are
created using the specified instance template.
This operation is marked as DONE when the group is created
even if the instances in the group have not yet been created. You must
separately verify the status of the individual instances with thelistmanagedinstances
method.
A regional managed instance group can contain up to 2000 instances.
INSERT INTO google.compute.instance_group_managers (
data__targetStoppedSize,
data__instanceFlexibilityPolicy,
data__fingerprint,
data__allInstancesConfig,
data__listManagedInstancesResults,
data__statefulPolicy,
data__versions,
data__targetPools,
data__targetSize,
data__namedPorts,
data__instanceTemplate,
data__instanceLifecyclePolicy,
data__standbyPolicy,
data__autoHealingPolicies,
data__baseInstanceName,
data__resourcePolicies,
data__distributionPolicy,
data__updatePolicy,
data__name,
data__description,
data__targetSizePolicy,
data__targetSuspendedSize,
project,
region,
requestId
)
SELECT
{{ targetStoppedSize }},
'{{ instanceFlexibilityPolicy }}',
'{{ fingerprint }}',
'{{ allInstancesConfig }}',
'{{ listManagedInstancesResults }}',
'{{ statefulPolicy }}',
'{{ versions }}',
'{{ targetPools }}',
{{ targetSize }},
'{{ namedPorts }}',
'{{ instanceTemplate }}',
'{{ instanceLifecyclePolicy }}',
'{{ standbyPolicy }}',
'{{ autoHealingPolicies }}',
'{{ baseInstanceName }}',
'{{ resourcePolicies }}',
'{{ distributionPolicy }}',
'{{ updatePolicy }}',
'{{ name }}',
'{{ description }}',
'{{ targetSizePolicy }}',
{{ targetSuspendedSize }},
'{{ project }}',
'{{ region }}',
'{{ 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_group_managers
props:
- name: project
value: "{{ project }}"
description: Required parameter for the instance_group_managers resource.
- name: region
value: "{{ region }}"
description: Required parameter for the instance_group_managers resource.
- name: targetStoppedSize
value: {{ targetStoppedSize }}
description: |
The target number of stopped instances for this managed instance group.
This number changes when you:
- Stop instance using the stopInstances
method or start instances using the startInstances
method.
- Manually change the targetStoppedSize using the update
method.
- name: instanceFlexibilityPolicy
description: |
Instance flexibility allowing MIG to create VMs from multiple
types of machines.
Instance flexibility configuration on MIG overrides instance
template configuration.
value:
instanceSelections: "{{ instanceSelections }}"
- name: fingerprint
value: "{{ fingerprint }}"
description: |
Fingerprint of this resource. This field may be used in optimistic locking.
It will be ignored when inserting an InstanceGroupManager. An up-to-date
fingerprint must be provided in order to update the InstanceGroupManager,
otherwise the request will fail with error412 conditionNotMet.
To see the latest fingerprint, make a get() request to
retrieve an InstanceGroupManager.
- name: allInstancesConfig
description: |
Specifies configuration that overrides the instance template configuration
for the group.
value:
properties:
metadata: "{{ metadata }}"
labels: "{{ labels }}"
- name: listManagedInstancesResults
value: "{{ listManagedInstancesResults }}"
description: |
Pagination behavior of the listManagedInstances API method for
this managed instance group.
valid_values: ['PAGELESS', 'PAGINATED']
- name: statefulPolicy
description: |
Stateful configuration for this Instanced Group Manager
value:
preservedState:
disks: "{{ disks }}"
internalIPs: "{{ internalIPs }}"
externalIPs: "{{ externalIPs }}"
- name: versions
description: |
Specifies the instance templates used by this managed instance group to
create instances.
Each version is defined by an instanceTemplate and aname. Every version can appear at most once per instance
group. This field overrides the top-level instanceTemplate
field. Read more about therelationships
between these fields. Exactly one version must leave thetargetSize field unset. That version will be applied to all
remaining instances. For more information, read aboutcanary
updates.
value:
- name: "{{ name }}"
instanceTemplate: "{{ instanceTemplate }}"
targetSize:
calculated: {{ calculated }}
fixed: {{ fixed }}
percent: {{ percent }}
- name: targetPools
value:
- "{{ targetPools }}"
description: |
The URLs for all TargetPool resources to which instances in theinstanceGroup field are added. The target pools automatically
apply to all of the instances in the managed instance group.
- name: targetSize
value: {{ targetSize }}
description: |
The target number of running instances for this managed instance group.
You can reduce this number by using the instanceGroupManager
deleteInstances or abandonInstances methods. Resizing the group also
changes this number.
- name: namedPorts
description: |
[Output Only] Named ports configured on the Instance Groups complementary
to this Instance Group Manager.
value:
- port: {{ port }}
name: "{{ name }}"
- name: instanceTemplate
value: "{{ instanceTemplate }}"
description: |
The URL of the instance template that is specified for this managed
instance group. The group uses this template to create all new instances
in the managed instance group. The templates for existing instances in the
group do not change unless you run recreateInstances, runapplyUpdatesToInstances, or set the group'supdatePolicy.type to PROACTIVE.
- name: instanceLifecyclePolicy
description: |
The repair policy for this managed instance group.
value:
onFailedHealthCheck: "{{ onFailedHealthCheck }}"
defaultActionOnFailure: "{{ defaultActionOnFailure }}"
onRepair:
allowChangingZone: "{{ allowChangingZone }}"
forceUpdateOnRepair: "{{ forceUpdateOnRepair }}"
- name: standbyPolicy
description: |
Standby policy for stopped and suspended instances.
value:
initialDelaySec: {{ initialDelaySec }}
mode: "{{ mode }}"
- name: autoHealingPolicies
description: |
The autohealing policy for this managed instance group. You can specify
only one value.
value:
- healthCheck: "{{ healthCheck }}"
initialDelaySec: {{ initialDelaySec }}
- name: baseInstanceName
value: "{{ baseInstanceName }}"
description: |
The base instance name is a prefix that you want to attach to the names of
all VMs in a MIG. The maximum character length is 58 and the name must
comply with RFC1035 format.
When a VM is created in the group, the MIG appends a hyphen and a random
four-character string to the base instance name. If you want the MIG to
assign sequential numbers instead of a random string, then end the base
instance name with a hyphen followed by one or more hash symbols. The hash
symbols indicate the number of digits. For example, a base instance name of
"vm-###" results in "vm-001" as a VM name.
@pattern
[a-z](([-a-z0-9]{0,57})|([-a-z0-9]{0,51}-#{1,10}(\[[0-9]{1,10}\])?))
- name: resourcePolicies
description: |
Resource policies for this managed instance group.
value:
workloadPolicy: "{{ workloadPolicy }}"
- name: distributionPolicy
description: |
Policy specifying the intended distribution of managed instances across
zones in a regional managed instance group.
value:
zones:
- zone: "{{ zone }}"
targetShape: "{{ targetShape }}"
- name: updatePolicy
description: |
The update policy for this managed instance group.
value:
replacementMethod: "{{ replacementMethod }}"
type: "{{ type }}"
maxSurge:
calculated: {{ calculated }}
fixed: {{ fixed }}
percent: {{ percent }}
maxUnavailable:
calculated: {{ calculated }}
fixed: {{ fixed }}
percent: {{ percent }}
instanceRedistributionType: "{{ instanceRedistributionType }}"
mostDisruptiveAllowedAction: "{{ mostDisruptiveAllowedAction }}"
minimalAction: "{{ minimalAction }}"
- name: name
value: "{{ name }}"
description: |
The name of the managed instance group. The name must be 1-63 characters
long, and comply withRFC1035.
- name: description
value: "{{ description }}"
description: |
An optional description of this resource.
- name: targetSizePolicy
description: |
The policy that specifies how the MIG creates its VMs to achieve the target
size.
value:
mode: "{{ mode }}"
- name: targetSuspendedSize
value: {{ targetSuspendedSize }}
description: |
The target number of suspended instances for this managed instance group.
This number changes when you:
- Suspend instance using the suspendInstances
method or resume instances using the resumeInstances
method.
- Manually change the targetSuspendedSize using the update
method.
- name: requestId
value: "{{ requestId }}"
UPDATE examples
- patch
- patch_per_instance_configs
Updates a managed instance group using the information that you specify
in the request.
This operation is marked as DONE when the group is patched
even if the instances in the group are still in the process of being
patched. You must separately verify the status of the individual instances
with the listmanagedinstances
method. This method supportsPATCH
semantics and uses theJSON merge
patch format and processing rules.
If you update your group to specify a new template or instance
configuration, it's possible that your intended specification for each VM
in the group is different from the current state of that VM. To learn how
to apply an updated configuration to the VMs in a MIG, seeUpdating instances in
a MIG.
UPDATE google.compute.instance_group_managers
SET
data__targetStoppedSize = {{ targetStoppedSize }},
data__instanceFlexibilityPolicy = '{{ instanceFlexibilityPolicy }}',
data__fingerprint = '{{ fingerprint }}',
data__allInstancesConfig = '{{ allInstancesConfig }}',
data__listManagedInstancesResults = '{{ listManagedInstancesResults }}',
data__statefulPolicy = '{{ statefulPolicy }}',
data__versions = '{{ versions }}',
data__targetPools = '{{ targetPools }}',
data__targetSize = {{ targetSize }},
data__namedPorts = '{{ namedPorts }}',
data__instanceTemplate = '{{ instanceTemplate }}',
data__instanceLifecyclePolicy = '{{ instanceLifecyclePolicy }}',
data__standbyPolicy = '{{ standbyPolicy }}',
data__autoHealingPolicies = '{{ autoHealingPolicies }}',
data__baseInstanceName = '{{ baseInstanceName }}',
data__resourcePolicies = '{{ resourcePolicies }}',
data__distributionPolicy = '{{ distributionPolicy }}',
data__updatePolicy = '{{ updatePolicy }}',
data__name = '{{ name }}',
data__description = '{{ description }}',
data__targetSizePolicy = '{{ targetSizePolicy }}',
data__targetSuspendedSize = {{ targetSuspendedSize }}
WHERE
project = '{{ project }}' --required
AND region = '{{ region }}' --required
AND instanceGroupManager = '{{ instanceGroupManager }}' --required
AND requestId = '{{ 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;
Inserts or patches per-instance configurations for the managed instance
group. perInstanceConfig.name serves as a key used to
distinguish whether to perform insert or patch.
UPDATE google.compute.instance_group_managers
SET
data__perInstanceConfigs = '{{ perInstanceConfigs }}'
WHERE
project = '{{ project }}' --required
AND region = '{{ region }}' --required
AND instanceGroupManager = '{{ instanceGroupManager }}' --required
AND requestId = '{{ 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
- delete
Deletes the specified managed instance group and all of the instances
in that group.
DELETE FROM google.compute.instance_group_managers
WHERE project = '{{ project }}' --required
AND region = '{{ region }}' --required
AND instanceGroupManager = '{{ instanceGroupManager }}' --required
AND noGracefulShutdown = '{{ noGracefulShutdown }}'
AND requestId = '{{ requestId }}'
;
Lifecycle Methods
- set_target_pools
- set_instance_template
- recreate_instances
- stop_instances
- start_instances
- apply_updates_to_instances
- resize
- abandon_instances
- suspend_instances
- resume_instances
Modifies the target pools to which all new instances in this group are
assigned. Existing instances in the group are not affected.
EXEC google.compute.instance_group_managers.set_target_pools
@project='{{ project }}' --required,
@region='{{ region }}' --required,
@instanceGroupManager='{{ instanceGroupManager }}' --required,
@requestId='{{ requestId }}'
@@json=
'{
"fingerprint": "{{ fingerprint }}",
"targetPools": "{{ targetPools }}"
}'
;
Sets the instance template to use when creating new instances or recreating
instances in this group. Existing instances are not affected.
EXEC google.compute.instance_group_managers.set_instance_template
@project='{{ project }}' --required,
@region='{{ region }}' --required,
@instanceGroupManager='{{ instanceGroupManager }}' --required,
@requestId='{{ requestId }}'
@@json=
'{
"instanceTemplate": "{{ instanceTemplate }}"
}'
;
Flags the specified VM instances in the managed instance group to be
immediately recreated. Each instance is recreated using the group's current
configuration. This operation is marked as DONE when the flag
is set even if the instances have not yet been recreated. You must
separately verify the status of each instance by checking itscurrentAction field; for more information, see Checking
the status of managed 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 has elapsed before the VM instance is removed or deleted.
You can specify a maximum of 1000 instances with this method per request.
EXEC google.compute.instance_group_managers.recreate_instances
@project='{{ project }}' --required,
@region='{{ region }}' --required,
@instanceGroupManager='{{ instanceGroupManager }}' --required,
@noGracefulShutdown={{ noGracefulShutdown }},
@requestId='{{ requestId }}'
@@json=
'{
"instances": "{{ instances }}"
}'
;
Flags the specified instances in the managed instance group to be
immediately stopped. You can only specify instances that are running in
this request. This method reduces thetargetSize and increases the targetStoppedSize
of the managed instance group by the number of instances that you stop.
The stopInstances operation is marked DONE if
the stopInstances request is successful. The underlying
actions take additional time. You must separately verify the status of theSTOPPING action with thelistmanagedinstances
method.
If the standbyPolicy.initialDelaySec field is set, the group
delays stopping the instances until initialDelaySec have
passed from instance.creationTimestamp (that is, when the
instance was created). This delay gives your application time to
set itself up and initialize on the instance. If more thaninitialDelaySec seconds have passed sinceinstance.creationTimestamp when this method is called, there
will be zero delay.
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 has elapsed before the VM instance is stopped.
Stopped instances can be started using the startInstances
method.
You can specify a maximum of 1000 instances with this method per request.
EXEC google.compute.instance_group_managers.stop_instances
@project='{{ project }}' --required,
@region='{{ region }}' --required,
@instanceGroupManager='{{ instanceGroupManager }}' --required,
@noGracefulShutdown={{ noGracefulShutdown }},
@requestId='{{ requestId }}'
@@json=
'{
"instances": "{{ instances }}",
"forceStop": {{ forceStop }}
}'
;
Flags the specified instances in the managed instance group to be
started. This method increases thetargetSize and decreases the targetStoppedSize
of the managed instance group by the number of instances that you start.
The startInstances operation is marked DONE if
the startInstances request is successful. The underlying
actions take additional time. You must separately verify the status of theSTARTING action with thelistmanagedinstances
method.
In this request, you can only specify instances that are stopped. For
example, if an instance was previously stopped using the stopInstances
method, it can be started using the startInstances method.
If a health check is attached to the managed instance group, the specified
instances will be verified as healthy after they are started.
You can specify a maximum of 1000 instances with this method per request.
EXEC google.compute.instance_group_managers.start_instances
@project='{{ project }}' --required,
@region='{{ region }}' --required,
@instanceGroupManager='{{ instanceGroupManager }}' --required,
@requestId='{{ requestId }}'
@@json=
'{
"instances": "{{ instances }}"
}'
;
Apply updates to selected instances the managed instance group.
EXEC google.compute.instance_group_managers.apply_updates_to_instances
@project='{{ project }}' --required,
@region='{{ region }}' --required,
@instanceGroupManager='{{ instanceGroupManager }}' --required
@@json=
'{
"mostDisruptiveAllowedAction": "{{ mostDisruptiveAllowedAction }}",
"minimalAction": "{{ minimalAction }}",
"allInstances": {{ allInstances }},
"instances": "{{ instances }}"
}'
;
Changes the intended size of the managed instance group. If you increase
the size, the group creates new instances using the current instance
template. If you decrease the size, the group deletes one or more
instances.
The resize operation is marked DONE if theresize request is successful. The underlying actions take
additional time. You must separately verify the status of thecreating or deleting actions with thelistmanagedinstances
method.
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 has elapsed before the VM instance is removed or deleted.
EXEC google.compute.instance_group_managers.resize
@project='{{ project }}' --required,
@region='{{ region }}' --required,
@instanceGroupManager='{{ instanceGroupManager }}' --required,
@size='{{ size }}' --required,
@requestId='{{ requestId }}'
;
Flags the specified instances to be immediately removed from the managed
instance group. Abandoning an instance does not delete the
instance, but it does remove the instance from any target pools that are
applied by the managed instance group. This method reduces thetargetSize of the managed instance group by the
number of instances that you abandon. This operation is marked asDONE when the action is scheduled even if the instances have
not yet been removed from the group. You must separately verify the
status of the abandoning action with thelistmanagedinstances
method.
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 has elapsed before the VM instance is removed or deleted.
You can specify a maximum of 1000 instances with this method per request.
EXEC google.compute.instance_group_managers.abandon_instances
@project='{{ project }}' --required,
@region='{{ region }}' --required,
@instanceGroupManager='{{ instanceGroupManager }}' --required,
@requestId='{{ requestId }}'
@@json=
'{
"instances": "{{ instances }}"
}'
;
Flags the specified instances in the managed instance group to be
immediately suspended. You can only specify instances that are running in
this request. This method reduces thetargetSize and increases the targetSuspendedSize
of the managed instance group by the number of instances that you suspend.
The suspendInstances operation is marked DONE if
the suspendInstances request is successful. The underlying
actions take additional time. You must separately verify the status of theSUSPENDING action with thelistmanagedinstances
method.
If the standbyPolicy.initialDelaySec field is set, the group
delays suspension of the instances until initialDelaySec have
passed from instance.creationTimestamp (that is, when the
instance was created). This delay gives your application time to
set itself up and initialize on the instance. If more thaninitialDelaySec seconds have passed sinceinstance.creationTimestamp when this method is called, there
will be zero delay.
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 has elapsed before the VM instance is suspended.
Suspended instances can be resumed using the resumeInstances
method.
You can specify a maximum of 1000 instances with this method per request.
EXEC google.compute.instance_group_managers.suspend_instances
@project='{{ project }}' --required,
@region='{{ region }}' --required,
@instanceGroupManager='{{ instanceGroupManager }}' --required,
@requestId='{{ requestId }}'
@@json=
'{
"instances": "{{ instances }}",
"forceSuspend": {{ forceSuspend }}
}'
;
Flags the specified instances in the managed instance group to be
resumed. This method increases thetargetSize and decreases the targetSuspendedSize
of the managed instance group by the number of instances that you resume.
The resumeInstances operation is marked DONE if
the resumeInstances request is successful. The underlying
actions take additional time. You must separately verify the status of theRESUMING action with thelistmanagedinstances
method.
In this request, you can only specify instances that are suspended. For
example, if an instance was previously suspended using the suspendInstances
method, it can be resumed using the resumeInstances method.
If a health check is attached to the managed instance group, the specified
instances will be verified as healthy after they are resumed.
You can specify a maximum of 1000 instances with this method per request.
EXEC google.compute.instance_group_managers.resume_instances
@project='{{ project }}' --required,
@region='{{ region }}' --required,
@instanceGroupManager='{{ instanceGroupManager }}' --required,
@requestId='{{ requestId }}'
@@json=
'{
"instances": "{{ instances }}"
}'
;