Apply configuration updates during repairs Stay organized with collections Save and categorize content based on your preferences.
This document describes how to configure your MIG to apply thelatest instance template andper-instance configurationswhen recreating a VM duringrepairoperations. Applying the latest available configuration during a repairoperation is also known asupdate on repair. This document also describes howto check whether update on repair is enabled in your MIG, and if enabled, how todisable update on repair.
By default, during a repair, a MIG recreates a VM using the same instanceconfiguration that was originally used to create the VM. If updates for thegroup's instancetemplate or per-instance configurations are available, then you have the optionto apply these changes to a VM being repaired.
If you want to automatically apply configuration updates to all or a set of VMs(PROACTIVE), or selectively update specific instances (OPPORTUNISTIC), seeApplying new configurations to VMs in a MIG.
PROACTIVEand you configure update on repair, then the MIG does not take into accountmaxUnavailableduring update on repair.For example, assume that themaxUnavailable is 5 and the MIG is already in theprocess of updating 5 VMs based on the update policy. Among the other VMs in theMIG, if 3 VMs fail, then the MIG updates all 3 failed VMs during theirrepair regardless ofmaxUnavailable.Before you begin
- 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.
Configure update on repair
To configure update on repair, use the Google Cloud console,gcloud CLI, or REST.
Console
In the Google Cloud console, go to theInstance groups page.
Click the name of the MIG where you want to configure update on repair.
ClickEdit to modify the MIG.
ClickInstance lifecycle and autohealing to expand the section.
In theUpdates during VM instance repair section, selectUpdate the instance configuration.
ClickSave.
gcloud
For an existing MIG, use theupdate command:
gcloud compute instance-groups managed updateMIG_NAME \--force-update-on-repair
For a new MIG, use thecreate command:
gcloud compute instance-groups managed createMIG_NAME \ --templateINSTANCE_TEMPLATE_URL_ \ --sizeSIZE \--force-update-on-repair
Replace the following:
MIG_NAME: The name of the instance group.INSTANCE_TEMPLATE_URL: the URL of the instance template that you want touse to create VMs in the MIG. The URL can contain either theIDor name of the instance template. Specify one of the following values:- For a regional instance template:
projects/PROJECT_ID/regions/REGION/instanceTemplates/INSTANCE_TEMPLATE_ID - For a global instance template:
INSTANCE_TEMPLATE_ID
- For a regional instance template:
SIZE: The target size of the instance group.
REST
For an existing zonal MIG, use theinstanceGroupManagers.patch method,or, for an existing regional MIG, use theregionInstanceGroupManagers.patch method.
Make the following call to configure update on repair in an existingzonal MIG:
PATCH https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instanceGroupManagers/MIG_NAME{ "instanceLifecyclePolicy": {"forceUpdateOnRepair": YES }}For a new zonal MIG, use theinstanceGroupManagers.insert method,or, for a new regional MIG, use theregionInstanceGroupManagers.insert method.
Make the following call to configure update on repair whencreating a zonal MIG:
POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instanceGroupManagers{ "name": "MIG_NAME", "instanceTemplate": "INSTANCE_TEMPLATE_URL", "targetSize":SIZE, "instanceLifecyclePolicy": {"forceUpdateOnRepair": YES }}Replace the following:
PROJECT_ID: Yourproject ID.ZONE: The zone where the MIG is located.MIG_NAME: The name of the instance group.INSTANCE_TEMPLATE_URL: the URL of the instance template that you want touse to create VMs in the MIG. The URL can contain either theIDor name of the instance template. Specify one of the following values:- For a regional instance template:
projects/PROJECT_ID/regions/REGION/instanceTemplates/INSTANCE_TEMPLATE_ID - For a global instance template:
INSTANCE_TEMPLATE_ID
- For a regional instance template:
SIZE: The target size of the instance group.
Check whether update on repair is enabled
By default, a MIG does not update a VM during a repair. To check whetherupdate on repair is enabled for your MIG, use the Google Cloud console,gcloud CLI,or REST to view update on repair configuration.
Console
In the Google Cloud console, go to theInstance groups page.
Click the name of the MIG of which you want to check the configuration.
ClickDetails tab.
In theVM instance lifecycle section, check the option selectedforUpdates during VM instance repair. If the field showsUpdate the instance configuration, then update on repair is enabled.
gcloud
Use thedescribe commandas follows:
gcloud compute instance-groups managed describeMIG_NAME \--format="(instanceLifecyclePolicy)"
In the response body, check for theforceUpdateOnRepair field, whichhas one of the following values:
NO: Default. MIG doesn't update VMs when they are repaired.YES: MIG updates the VMs during their repair.
The following is a sample output:
instanceLifecyclePolicy:forceUpdateOnRepair: YES
REST
For a zonal MIG, use theinstanceGroupManagers.get method,or, for a regional MIG, use theregionInstanceGroupManagers.get method.
For example, in a zonal MIG, use the following command:
GET https://compute.googleapis.com/compute/v1/PROJECT_ID/zones/ZONE/instanceGroupManagers/MIG_NAME
In the response body, check for theinstanceLifecyclePolicy.forceUpdateOnRepair field, which has one of thefollowing values:
NO: Default. MIG doesn't update VMs when they are repaired.YES: MIG updates the VMs during their repair.
The following is a sample response:
{ ... "name": "example-mig", "targetSize": 12, ... "instanceLifecyclePolicy": {"forceUpdateOnRepair": "YES" }, ...}Replace the following:
PROJECT_ID: Yourproject ID.ZONE: The zone where the MIG is located.MIG_NAME: The name of the instance group.
Disable update on repair
When your MIG repairs a VM, if you want the MIG to use the original instancetemplate or the per-instance configurations that were used to create the VM,then you must disable update on repair. By default, update on repair isdisabled for a MIG.
Use the Google Cloud console, gcloud CLI,or REST to disable update on repair.
Console
In the Google Cloud console, go to theInstance groups page.
Click the name of the MIG where you want to disable update on repair.
ClickEdit to modify the MIG.
ClickInstance lifecycle and autohealing to expand the section.
In theUpdates during VM instance repair section, selectKeep the same instance configuration.
ClickSave.
gcloud
Use theupdate commandto set the--no-force-update-on-repair flag as follows:
gcloud compute instance-groups managed updateMIG_NAME \--no-force-update-on-repair
REST
For a zonal MIG, use theinstanceGroupManagers.patch method,or, for a regional MIG, use theregionInstanceGroupManagers.patch method.
For example, to disable update on repair for a zonal MIG, use the followingcommand:
PATCH https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instanceGroupManagers/MIG_NAME{ "instanceLifecyclePolicy": { "forceUpdateOnRepair": NO }}Replace the following:
PROJECT_ID: Yourproject ID.ZONE: The zone where the MIG is located.MIG_NAME: The name of the instance group.
What's next
- Set up application health check and autohealing.
- If you have configured an application-based health check for your MIG,monitor VM health state changes.
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-18 UTC.