Apply configuration updates during repairs

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.

Note: If the update type of your MIG is set toPROACTIVEand 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

Configure update on repair

To configure update on repair, use the Google Cloud console,gcloud CLI, or REST.

Console

  1. In the Google Cloud console, go to theInstance groups page.

    Go to Instance groups

  2. Click the name of the MIG where you want to configure update on repair.

  3. ClickEdit to modify the MIG.

  4. ClickInstance lifecycle and autohealing to expand the section.

  5. In theUpdates during VM instance repair section, selectUpdate the instance configuration.

  6. 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
  • 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
  • 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

  1. In the Google Cloud console, go to theInstance groups page.

    Go to Instance groups

  2. Click the name of the MIG of which you want to check the configuration.

  3. ClickDetails tab.

  4. 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

  1. In the Google Cloud console, go to theInstance groups page.

    Go to Instance groups

  2. Click the name of the MIG where you want to disable update on repair.

  3. ClickEdit to modify the MIG.

  4. ClickInstance lifecycle and autohealing to expand the section.

  5. In theUpdates during VM instance repair section, selectKeep the same instance configuration.

  6. 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

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.