Skip to main content

instance_group_managers

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

Overview

Nameinstance_group_managers
TypeResource
Idgoogle.compute.instance_group_managers

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
idstring (uint64)[Output Only] A unique identifier for this resource type. The server generates this identifier.
namestringThe 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])?)
allInstancesConfigobjectSpecifies configuration that overrides the instance template configuration for the group. (id: InstanceGroupManagerAllInstancesConfig)
autoHealingPoliciesarrayThe autohealing policy for this managed instance group. You can specify only one value.
baseInstanceNamestringThe 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}\])?))
creationTimestampstring[Output Only] The creation timestamp for this managed instance group in RFC3339 text format.
currentActionsobject[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)
descriptionstringAn optional description of this resource.
distributionPolicyobjectPolicy specifying the intended distribution of managed instances across zones in a regional managed instance group. (id: DistributionPolicy)
fingerprintstring (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.
instanceFlexibilityPolicyobjectInstance flexibility allowing MIG to create VMs from multiple types of machines. Instance flexibility configuration on MIG overrides instance template configuration. (id: InstanceGroupManagerInstanceFlexibilityPolicy)
instanceGroupstring[Output Only] The URL of the Instance Group resource.
instanceLifecyclePolicyobjectThe repair policy for this managed instance group. (id: InstanceGroupManagerInstanceLifecyclePolicy)
instanceTemplatestringThe 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.
kindstring[Output Only] The resource type, which is always compute#instanceGroupManager for managed instance groups. (default: compute#instanceGroupManager)
listManagedInstancesResultsstringPagination behavior of the listManagedInstances API method for this managed instance group.
namedPortsarray[Output Only] Named ports configured on the Instance Groups complementary to this Instance Group Manager.
regionstring[Output Only] The URL of the region where the managed instance group resides (for regional resources).
resourcePoliciesobjectResource policies for this managed instance group. (id: InstanceGroupManagerResourcePolicies)
satisfiesPziboolean[Output Only] Reserved for future use.
satisfiesPzsboolean[Output Only] Reserved for future use.
selfLinkstring[Output Only] The URL for this managed instance group. The server defines this URL.
standbyPolicyobjectStandby policy for stopped and suspended instances. (id: InstanceGroupManagerStandbyPolicy)
statefulPolicyobjectStateful configuration for this Instanced Group Manager (id: StatefulPolicy)
statusobject[Output Only] The status of this managed instance group. (id: InstanceGroupManagerStatus)
targetPoolsarrayThe 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.
targetSizeinteger (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.
targetStoppedSizeinteger (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.
targetSuspendedSizeinteger (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.
updatePolicyobjectThe update policy for this managed instance group. (id: InstanceGroupManagerUpdatePolicy)
versionsarraySpecifies 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.
zonestring[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:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectproject, region, instanceGroupManagerReturns all of the details about the specified managed instance group.
listselectproject, regionfilter, maxResults, orderBy, pageToken, returnPartialSuccessRetrieves the list of managed instance groups that are contained within the specified region.
aggregated_listselectprojectfilter, includeAllScopes, maxResults, orderBy, pageToken, returnPartialSuccess, serviceProjectNumberRetrieves the list of managed instance groups and groups them by zone. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
insertinsertproject, regionrequestIdCreates 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.
patchupdateproject, region, instanceGroupManagerrequestIdUpdates 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_configsupdateproject, region, instanceGroupManagerrequestIdInserts 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.
deletedeleteproject, region, instanceGroupManagerrequestIdDeletes the specified managed instance group and all of the instances in that group.
suspend_instancesexecproject, region, instanceGroupManagerrequestIdFlags 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_instancesexecproject, region, instanceGroupManagerrequestIdFlags 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_instancesexecproject, region, instanceGroupManagerrequestIdFlags 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_instancesexecproject, region, instanceGroupManagerrequestIdFlags 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_instancesexecproject, region, instanceGroupManagerrequestIdFlags 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_instancesexecproject, region, instanceGroupManagerrequestIdFlags 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.
resizeexecproject, region, instanceGroupManager, sizerequestIdChanges 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_templateexecproject, region, instanceGroupManagerrequestIdSets the instance template to use when creating new instances or recreating instances in this group. Existing instances are not affected.
set_target_poolsexecproject, region, instanceGroupManagerrequestIdModifies the target pools to which all new instances in this group are assigned. Existing instances in the group are not affected.
apply_updates_to_instancesexecproject, region, instanceGroupManagerApply 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.

NameDatatypeDescription
instanceGroupManagerstring
projectstring
regionstring
sizeinteger (int32)
filterstring
includeAllScopesboolean
maxResultsinteger (uint32)
orderBystring
pageTokenstring
requestIdstring
returnPartialSuccessboolean
serviceProjectNumberstring (int64)

SELECT examples

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;

INSERT examples

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
;

UPDATE examples

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;

DELETE examples

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

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 }}
}';