Work with managed instances Stay organized with collections Save and categorize content based on your preferences.
Amanaged instance group (MIG)creates each of its managed instances based on theconfiguration componentsthat you use: instance template, optional all-instances configuration, andoptional stateful configuration.
Eachmanaged instance is a data entity that represents theintended state for an actual virtual machine (VM) instance in a MIG.
Read this document to learn how to reliably work with the managed instances ina MIG. For example, you might need to add, remove, update, or view informationabout a specific instance.
To ensure that your configuration changes aren't reverted by the MIG, it'simportant to use the methods that are described in this document. If you workoutside the group's methods to modify a MIG's VMs, the MIG might or might notdetect that those VMs are no longer using the group's intended configuration,and you might experience unexpected results. For example, if you delete orupdate a VM in a MIG by using the instances API instead of the requiredinstance group manager API, the MIG will not be aware of your intent and, atany time in the future, the MIG might automatically attempt to recreate orrevert that VM according to the MIG's configuration.
Before you begin
- Review thelimitations thencreate a group.
- If you haven't already, set upauthentication. Authentication verifies your identity for access to Google Cloud services and APIs. To run code or samples from a local development environment, you can authenticate to Compute Engine by selecting one of the following options:
Select the tab for how you plan to use the samples on this page:
Console
When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.
gcloud
Install the Google Cloud CLI. After installation,initialize the Google Cloud CLI by running the following command:
gcloudinit
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update.- Set a default region and zone.
REST
To use the REST API samples on this page in a local development environment, you use the credentials you provide to the gcloud CLI.
Install the Google Cloud CLI. After installation,initialize the Google Cloud CLI by running the following command:
gcloudinit
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update.For more information, seeAuthenticate for using REST in the Google Cloud authentication documentation.
What is a managed instance?
A managed instance is a data entity within a MIG that contains the currentstatus and intended state for an actual VM instance.
The current status of a managed instance includes the following fields:
- Instancelifecycle status—forexample,
RUNNING,STOPPING. - Current actionperformed by the MIG on an instance—for example:
RESTARTING,VERIFYING,NONE. - Instancehealth state—forexample,
HEALTHY,UNHEALTHY.
A managed instance's intended state for an actual VM instance includes thefollowing:
- Intendedversion,that is, the version name and instance template to be used for the instance.
- Preserved state ofitems (such as disks or metadata) to be preserved.
As shown in figure 1, for each managed instance in a MIG, the MIG keeps anactual VM up and running according to the managed instance's specification.

Figure 1. Relationship between managed instances and corresponding VMs.
Note: Various policies and actions create, delete, and modify the VMinstances in a MIG. Those operations are returned asDONE after the group hasscheduled actions to create, delete, or update those instances. However, thisdoesn't mean that the actual instances in the group have been created,deleted, or updated until those underlying actions are complete. You mustverify the status of the grouporverify the status of those instances.To view the specifications of a managed instance, seeViewing information about the managed instances in a MIG.
Add instances to a MIG
To add more instances to a MIG, you can do the following:
- Manually set the size of the MIG
- Use resize requests to create VMs all at once
- Use autoscaling for stateless applications
- Add instances with specific names
To verify that newly added instances are up and running,verify the status of the grouporverify the status of the managed instances.
Manually set the size of the MIG
If a managed instance group isn't already set to automatically scale, then youcan manually set the size of the group to change the number of instances in thegroup. For more information, seeManually resizing a MIG.
Use resize requests to create VMs all at once
You can use resize requests to add GPU VMs to a MIG all at once. This featurehelps you avoid charges for partial capacity while Compute Engineprovisions all resources. MIG resize requests use the flex-start orreservation-bound provisioning models. These models let you obtain vCPUs andGPUs at a discounted price. For more information, seeAbout resize requests in a MIG.
Use autoscaling for stateless applications
You can configure managed instance groups to automatically add or removeinstances based on their workloads. Your applications can gracefully handleincreases in traffic, and you can reduce your costs when the need for computeresources is lower. For more information about automatically scaling your MIG,seeAutoscaling groups of instances.
Add instances with specific names
If your workload or orchestration system requires specific instance names, youcan add instances with those names to an existing MIG. The names that you assignto these instances persist if the MIG recreates them.
Based on how you want to add instances with specific names to a MIG, use one ofthe following methods:
To add GPU instances all at once to a MIG,create a resize request.
To add instances to a MIG as resources become available,create instances with specific names.
Delete instances from a MIG
When you deletemanaged instances, the MIGreduces thetargetSize of the group and deletes the corresponding VMinstances.
If you set up astateful MIG, then the MIGdeletes the instances' preserved state configurations. The MIG also removes theinstances from anytarget poolsof which they are a member.
If the group is part of abackend service thathasenabled connection draining,it can take up to an additional 60 seconds after the connection drainingduration has elapsed before the VM instance is removed or deleted.
To delete a managed instance, you can:
- Resize the MIG. The MIG chooses which instances to delete.
- Manually resizethe MIG.
- Use autoscaling for stateless applications.
- Delete the whole group.
- Delete orabandon specific instances explicitly.
Update VM configuration in a MIG
If you need to change the configuration of VMs in a MIG—for example, to modifythe boot disk or machine type, add disks, or change other VM properties—seeUpdating VM configuration in a MIG.
Recreate instances in a MIG
Use this method to update selected VMs so that they use the group's latestVM configuration components.If you need to recreate all of the VMs in a managed instance group, start arolling updateinstead.
If the group is part of abackend service thathasenabled connection draining,it can take up to an additional 60 seconds after the connection drainingduration has elapsed before the VM instance is removed or deleted.
Recreate selected VM instances in a managed instance group using thegcloud CLI,orREST.
Permissions required for this task
To perform this task, you must have the followingpermissions:
compute.instanceGroupManagers.updateon the managed instance group
gcloud
Use theinstance-groups managed recreate-instances command.
gcloud compute instance-groups managed recreate-instancesINSTANCE_GROUP_NAME \ --instancesINSTANCE_NAME_1,INSTANCE_NAME_2 \ [--regionREGION | --zoneZONE]
REST
In the API, make a POST request to theregionInstanceGroupManagers.recreateInstancesmethod. For a zonal managed instance group, use theinstanceGroupManagers.recreateInstancesmethod.
POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/instanceGroupManagers/INSTANCE_GROUP_NAME/recreateInstances{ "instances": [ "zones/ZONE/instances/INSTANCE_NAME_1", "zones/ZONE/instances/INSTANCE_NAME_2" ]}After you make a request to recreate VM instances in a managedinstance group, the new VMs start as soon as the system can provisionthem. This process can take a significant amount of time depending on thenumber of instances that you recreate.Verify the status of the grouporverify the status of the managed instances.
The recreate operation preserves the VM instance name, but the instance creationtimestamp might not change. To confirm that the recreate operation has createda new instance when the instance creation timestamp has not changed, check thecreation timestamp of the boot disk attached to that instance.
View information about instances in a MIG
SeeViewing info about the managed instances in a MIG.
Configure stateful instances in a MIG
What's next
- Learn aboutapplying new configurations to VMs in a MIGs.
- Learn aboutApplying machine type recommendations for MIGs.
- Try a tutorial:
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-02-19 UTC.