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:

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 withRFC1035. (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}\])?))
creationTimestampstringOutput only. The creation timestamp for this managed instance group inRFC3339 text format.
currentActionsobjectOutput 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 error412 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)
instanceGroupstringOutput 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, runapplyUpdatesToInstances, or set the group'supdatePolicy.type to PROACTIVE.
kindstringOutput only. The resource type, which is alwayscompute#instanceGroupManager for managed instance groups. (default: compute#instanceGroupManager)
listManagedInstancesResultsstringPagination behavior of the listManagedInstances API method for this managed instance group. (PAGELESS, PAGINATED)
namedPortsarray[Output Only] Named ports configured on the Instance Groups complementary to this Instance Group Manager.
regionstringOutput only. [Output Only] The URL of theregion where the managed instance group resides (for regional resources).
resourcePoliciesobjectResource policies for this managed instance group. (id: InstanceGroupManagerResourcePolicies)
satisfiesPzibooleanOutput only. Reserved for future use.
satisfiesPzsbooleanOutput only. Reserved for future use.
selfLinkstringOutput 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)
statusobjectOutput only. The status of this managed instance group. (id: InstanceGroupManagerStatus)
targetPoolsarrayThe 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.
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.
targetSizePolicyobjectThe policy that specifies how the MIG creates its VMs to achieve the target size. (id: InstanceGroupManagerTargetSizePolicy)
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 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.
zonestringOutput only. The URL of azone 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, pageToken, orderBy, returnPartialSuccessRetrieves the list of managed instance groups that are contained
within the specified region.
aggregated_listselectprojectincludeAllScopes, orderBy, filter, serviceProjectNumber, maxResults, pageToken, returnPartialSuccessRetrieves 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 thelistmanagedinstances
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 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_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, instanceGroupManagernoGracefulShutdown, requestIdDeletes the specified managed instance group and all of the instances
in that group.
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.
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.
recreate_instancesexecproject, region, instanceGroupManagernoGracefulShutdown, requestIdFlags 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_instancesexecproject, region, instanceGroupManagernoGracefulShutdown, requestIdFlags 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_instancesexecproject, region, instanceGroupManagerrequestIdFlags 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_instancesexecproject, region, instanceGroupManagerApply updates to selected instances the managed instance group.
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 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_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 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_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 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_instancesexecproject, region, instanceGroupManagerrequestIdFlags 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.

NameDatatypeDescription
instanceGroupManagerstring
projectstring
regionstring
sizeinteger (int32)
filterstring
includeAllScopesboolean
maxResultsinteger (uint32)
noGracefulShutdownboolean
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,
targetSizePolicy,
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 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
;

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

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 noGracefulShutdown = '{{ noGracefulShutdown }}'
AND requestId = '{{ requestId }}'
;

Lifecycle Methods

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