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
Successful response
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 with RFC1035. (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 in RFC3339 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 error 412 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, run applyUpdatesToInstances, or set the group's updatePolicy.type to PROACTIVE. |
kind | string | [Output Only] The resource type, which is always compute#instanceGroupManager for managed instance groups. (default: compute#instanceGroupManager) |
listManagedInstancesResults | string | Pagination behavior of the listManagedInstances API method for this managed instance group. |
namedPorts | array | [Output Only] Named ports configured on the Instance Groups complementary to this Instance Group Manager. |
region | string | [Output Only] The URL of the region 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 the instanceGroup 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. |
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 a name. Every version can appear at most once per instance group. This field overrides the top-level instanceTemplate field. Read more about the relationships between these fields. Exactly one version must leave the targetSize field unset. That version will be applied to all remaining instances. For more information, read about canary updates. |
zone | string | [Output Only] The URL of a zone where the managed instance group is located (for zonal resources). |
Successful response
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 than maxResults, 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. |
Successful response
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 with RFC1035. (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 in RFC3339 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 error 412 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, run applyUpdatesToInstances, or set the group's updatePolicy.type to PROACTIVE. |
kind | string | [Output Only] The resource type, which is always compute#instanceGroupManager for managed instance groups. (default: compute#instanceGroupManager) |
listManagedInstancesResults | string | Pagination behavior of the listManagedInstances API method for this managed instance group. |
namedPorts | array | [Output Only] Named ports configured on the Instance Groups complementary to this Instance Group Manager. |
region | string | [Output Only] The URL of the region 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 the instanceGroup 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. |
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 a name. Every version can appear at most once per instance group. This field overrides the top-level instanceTemplate field. Read more about the relationships between these fields. Exactly one version must leave the targetSize field unset. That version will be applied to all remaining instances. For more information, read about canary updates. |
zone | string | [Output Only] The URL of a zone 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 , orderBy , pageToken , returnPartialSuccess | Retrieves the list of managed instance groups that are contained within the specified region. |
aggregated_list | select | project | filter , includeAllScopes , maxResults , orderBy , pageToken , returnPartialSuccess , serviceProjectNumber | 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 the listmanagedinstances 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 supports PATCH semantics and uses the JSON 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, see Updating 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 | requestId | Deletes the specified managed instance group and all of the instances in that group. |
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 the targetSize 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 the SUSPENDING action with the listmanagedinstances 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 than initialDelaySec seconds have passed since instance.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 the targetSize 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 the RESUMING action with the listmanagedinstances 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. |
stop_instances | exec | project , region , instanceGroupManager | 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 the targetSize 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 the STOPPING action with the listmanagedinstances 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 than initialDelaySec seconds have passed since instance.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 the targetSize 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 the STARTING action with the listmanagedinstances 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. |
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 the targetSize of the managed instance group by the number of instances that you abandon. This operation is marked as DONE 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 the listmanagedinstances 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. |
recreate_instances | exec | project , region , instanceGroupManager | 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 its currentAction 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. |
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 the resize request is successful. The underlying actions take additional time. You must separately verify the status of the creating or deleting actions with the listmanagedinstances 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. |
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. |
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. |
apply_updates_to_instances | exec | project , region , instanceGroupManager | Apply updates to selected instances the managed 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 |
---|---|---|
instanceGroupManager | string | |
project | string | |
region | string | |
size | integer (int32) | |
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 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,
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 orderBy = '{{ orderBy }}'
AND pageToken = '{{ pageToken }}'
AND returnPartialSuccess = '{{ 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
.
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,
targetStoppedSize,
targetSuspendedSize,
updatePolicy,
versions,
zone
FROM google.compute.instance_group_managers
WHERE project = '{{ project }}' -- required
AND filter = '{{ filter }}'
AND includeAllScopes = '{{ includeAllScopes }}'
AND maxResults = '{{ maxResults }}'
AND orderBy = '{{ orderBy }}'
AND pageToken = '{{ pageToken }}'
AND returnPartialSuccess = '{{ returnPartialSuccess }}'
AND serviceProjectNumber = '{{ serviceProjectNumber }}';
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 the listmanagedinstances method. A regional managed instance group can contain up to 2000 instances.
INSERT INTO google.compute.instance_group_managers (
data__kind,
data__id,
data__creationTimestamp,
data__name,
data__description,
data__zone,
data__region,
data__distributionPolicy,
data__instanceTemplate,
data__versions,
data__allInstancesConfig,
data__instanceGroup,
data__targetPools,
data__baseInstanceName,
data__fingerprint,
data__currentActions,
data__status,
data__targetSize,
data__instanceFlexibilityPolicy,
data__targetStoppedSize,
data__targetSuspendedSize,
data__listManagedInstancesResults,
data__standbyPolicy,
data__selfLink,
data__autoHealingPolicies,
data__updatePolicy,
data__namedPorts,
data__statefulPolicy,
data__instanceLifecyclePolicy,
data__satisfiesPzi,
data__satisfiesPzs,
data__resourcePolicies,
project,
region,
requestId
)
SELECT
'{{ kind }}',
'{{ id }}',
'{{ creationTimestamp }}',
'{{ name }}',
'{{ description }}',
'{{ zone }}',
'{{ region }}',
'{{ distributionPolicy }}',
'{{ instanceTemplate }}',
'{{ versions }}',
'{{ allInstancesConfig }}',
'{{ instanceGroup }}',
'{{ targetPools }}',
'{{ baseInstanceName }}',
'{{ fingerprint }}',
'{{ currentActions }}',
'{{ status }}',
{{ targetSize }},
'{{ instanceFlexibilityPolicy }}',
{{ targetStoppedSize }},
{{ targetSuspendedSize }},
'{{ listManagedInstancesResults }}',
'{{ standbyPolicy }}',
'{{ selfLink }}',
'{{ autoHealingPolicies }}',
'{{ updatePolicy }}',
'{{ namedPorts }}',
'{{ statefulPolicy }}',
'{{ instanceLifecyclePolicy }}',
{{ satisfiesPzi }},
{{ satisfiesPzs }},
'{{ resourcePolicies }}',
'{{ project }}',
'{{ region }}',
'{{ requestId }}'
RETURNING
id,
name,
clientOperationId,
creationTimestamp,
description,
endTime,
error,
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: string
description: Required parameter for the instance_group_managers resource.
- name: region
value: string
description: Required parameter for the instance_group_managers resource.
- name: kind
value: string
description: >
[Output Only] The resource type, which is always compute#instanceGroupManager for managed instance groups.
default: compute#instanceGroupManager
- name: id
value: string
description: >
[Output Only] A unique identifier for this resource type. The server generates this identifier.
- name: creationTimestamp
value: string
description: >
[Output Only] The creation timestamp for this managed instance group in RFC3339 text format.
- name: name
value: string
description: >
The name of the managed instance group. The name must be 1-63 characters long, and comply with RFC1035.
- name: description
value: string
description: >
An optional description of this resource.
- name: zone
value: string
description: >
[Output Only] The URL of a zone where the managed instance group is located (for zonal resources).
- name: region
value: string
description: >
[Output Only] The URL of the region where the managed instance group resides (for regional resources).
- name: distributionPolicy
value: object
description: >
Policy specifying the intended distribution of managed instances across zones in a regional managed instance group.
- name: instanceTemplate
value: string
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, run applyUpdatesToInstances, or set the group's updatePolicy.type to PROACTIVE.
- name: versions
value: array
description: >
Specifies the instance templates used by this managed instance group to create instances. Each version is defined by an instanceTemplate and a name. Every version can appear at most once per instance group. This field overrides the top-level instanceTemplate field. Read more about the relationships between these fields. Exactly one version must leave the targetSize field unset. That version will be applied to all remaining instances. For more information, read about canary updates.
- name: allInstancesConfig
value: object
description: >
Specifies configuration that overrides the instance template configuration for the group.
- name: instanceGroup
value: string
description: >
[Output Only] The URL of the Instance Group resource.
- name: targetPools
value: array
description: >
The URLs for all TargetPool resources to which instances in the instanceGroup field are added. The target pools automatically apply to all of the instances in the managed instance group.
- name: baseInstanceName
value: string
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: fingerprint
value: string
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 error 412 conditionNotMet. To see the latest fingerprint, make a get() request to retrieve an InstanceGroupManager.
- name: currentActions
value: object
description: >
[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.
- name: status
value: object
description: >
[Output Only] The status of this managed instance group.
- name: targetSize
value: integer
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: instanceFlexibilityPolicy
value: object
description: >
Instance flexibility allowing MIG to create VMs from multiple types of machines. Instance flexibility configuration on MIG overrides instance template configuration.
- name: targetStoppedSize
value: integer
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: targetSuspendedSize
value: integer
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: listManagedInstancesResults
value: string
description: >
Pagination behavior of the listManagedInstances API method for this managed instance group.
valid_values: ['PAGELESS', 'PAGINATED']
- name: standbyPolicy
value: object
description: >
Standby policy for stopped and suspended instances.
- name: selfLink
value: string
description: >
[Output Only] The URL for this managed instance group. The server defines this URL.
- name: autoHealingPolicies
value: array
description: >
The autohealing policy for this managed instance group. You can specify only one value.
- name: updatePolicy
value: object
description: >
The update policy for this managed instance group.
- name: namedPorts
value: array
description: >
[Output Only] Named ports configured on the Instance Groups complementary to this Instance Group Manager.
- name: statefulPolicy
value: object
description: >
Stateful configuration for this Instanced Group Manager
- name: instanceLifecyclePolicy
value: object
description: >
The repair policy for this managed instance group.
- name: satisfiesPzi
value: boolean
description: >
[Output Only] Reserved for future use.
- name: satisfiesPzs
value: boolean
description: >
[Output Only] Reserved for future use.
- name: resourcePolicies
value: object
description: >
Resource policies for this managed instance group.
- name: requestId
value: string
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 supports PATCH semantics and uses the JSON 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, see Updating instances in a MIG.
UPDATE google.compute.instance_group_managers
SET
data__kind = '{{ kind }}',
data__id = '{{ id }}',
data__creationTimestamp = '{{ creationTimestamp }}',
data__name = '{{ name }}',
data__description = '{{ description }}',
data__zone = '{{ zone }}',
data__region = '{{ region }}',
data__distributionPolicy = '{{ distributionPolicy }}',
data__instanceTemplate = '{{ instanceTemplate }}',
data__versions = '{{ versions }}',
data__allInstancesConfig = '{{ allInstancesConfig }}',
data__instanceGroup = '{{ instanceGroup }}',
data__targetPools = '{{ targetPools }}',
data__baseInstanceName = '{{ baseInstanceName }}',
data__fingerprint = '{{ fingerprint }}',
data__currentActions = '{{ currentActions }}',
data__status = '{{ status }}',
data__targetSize = {{ targetSize }},
data__instanceFlexibilityPolicy = '{{ instanceFlexibilityPolicy }}',
data__targetStoppedSize = {{ targetStoppedSize }},
data__targetSuspendedSize = {{ targetSuspendedSize }},
data__listManagedInstancesResults = '{{ listManagedInstancesResults }}',
data__standbyPolicy = '{{ standbyPolicy }}',
data__selfLink = '{{ selfLink }}',
data__autoHealingPolicies = '{{ autoHealingPolicies }}',
data__updatePolicy = '{{ updatePolicy }}',
data__namedPorts = '{{ namedPorts }}',
data__statefulPolicy = '{{ statefulPolicy }}',
data__instanceLifecyclePolicy = '{{ instanceLifecyclePolicy }}',
data__satisfiesPzi = {{ satisfiesPzi }},
data__satisfiesPzs = {{ satisfiesPzs }},
data__resourcePolicies = '{{ resourcePolicies }}'
WHERE
project = '{{ project }}' --required
AND region = '{{ region }}' --required
AND instanceGroupManager = '{{ instanceGroupManager }}' --required
AND requestId = '{{ requestId}}'
RETURNING
id,
name,
clientOperationId,
creationTimestamp,
description,
endTime,
error,
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,
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 requestId = '{{ requestId }}';
Lifecycle Methods
- suspend_instances
- resume_instances
- stop_instances
- start_instances
- abandon_instances
- recreate_instances
- resize
- set_instance_template
- set_target_pools
- apply_updates_to_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 the targetSize 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 the SUSPENDING action with the listmanagedinstances 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 than initialDelaySec seconds have passed since instance.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 the targetSize 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 the RESUMING action with the listmanagedinstances 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 }}"
}';
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 the targetSize 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 the STOPPING action with the listmanagedinstances 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 than initialDelaySec seconds have passed since instance.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,
@requestId='{{ requestId }}'
@@json=
'{
"instances": "{{ instances }}",
"forceStop": {{ forceStop }}
}';
Flags the specified instances in the managed instance group to be started. This method increases the targetSize 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 the STARTING action with the listmanagedinstances 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 }}"
}';
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 the targetSize of the managed instance group by the number of instances that you abandon. This operation is marked as DONE 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 the listmanagedinstances 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 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 its currentAction 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,
@requestId='{{ requestId }}'
@@json=
'{
"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 the resize request is successful. The underlying actions take additional time. You must separately verify the status of the creating or deleting actions with the listmanagedinstances 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 }}';
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 }}"
}';
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=
'{
"targetPools": "{{ targetPools }}",
"fingerprint": "{{ fingerprint }}"
}';
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=
'{
"instances": "{{ instances }}",
"minimalAction": "{{ minimalAction }}",
"mostDisruptiveAllowedAction": "{{ mostDisruptiveAllowedAction }}",
"allInstances": {{ allInstances }}
}';