Turn off repairs in a MIG Stay organized with collections Save and categorize content based on your preferences.
Preview — Action on failed health check
This feature is subject to the "Pre-GA Offerings Terms" in the General Service Terms section of theService Specific Terms. Pre-GA features are available "as is" and might have limited support. For more information, see thelaunch stage descriptions.
This document describes how to turn off repairs of failed and unhealthy VMs in amanaged instance group (MIG) and, if already turned off, how to configure theMIG to repair VMs.
By default, a MIG automatically repairs a failed VM in the group by recreatingthat VM. If you've configured an application-based health check, then the MIGalso repairs unhealthy VMs on which your application fails the healthcheck. Repairing a VM based on an application-based health check is also calledautohealing.
If you don't want a MIG to repair a failed VM or an unhealthy VM, you can turnoff repairs in the MIG. Turning off repairs is useful in scenarios when you wantto troubleshoot a failed VM, implement your own repair logic, or monitorapplication health without repairing unhealthy VMs.
To check whether repairs are already turned off in a MIG,check the repair configuration in a MIG.
For more information about repairs in a MIG, seeAbout repairing VMs for high availability.
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.
Turn off repairs in a MIG
When you turn off repairs in a MIG, by default, both failed VM repairs andautohealing are turned off. If you only want to turn off autohealing, seeTurn off autohealing.
Permissions required for this task
To perform this task, you must have the followingpermissions:
compute.instanceGroupManagers.updateon the managed instance group
Console
In the Google Cloud console, go to theInstance groups page.
Click the name of the MIG in which you want to turn off repair.
ClickEdit.
ClickInstance lifecycle and autohealing to expand the section.
- In theAction on failure section, set theDefault action onfailure field toNo action.
- If you've configured autohealing and don't want the MIG to turn offautohealing, then in theAutohealing section, set theOn failed health check field toRepair instance.
ClickSave.
gcloud
To turn off repairs in a MIG, then use theupdate commandas follows. This turns off autohealing by default.
gcloud compute instance-groups managed updateMIG_NAME \ --default-action-on-vm-failure=do-nothing \ --zone=ZONE
If autohealing is configured in the MIG and you don't want to turn offautohealing by default, use thebetaupdate commandto set the--action-on-vm-failed-health-check flag torepair. This ensures that autohealing of unhealthy VMs continues to workeven if repairing failed VMs is turned off.
gcloud beta compute instance-groups managed updateMIG_NAME \ --default-action-on-vm-failure=do-nothing \ --action-on-vm-failed-health-check=repair \ --zone=ZONE
Replace the following:
MIG_NAME: the name of the instance group.ZONE: the zone where your MIG is located. For aregional MIG, use the--region=REGIONflag.
REST
To turn off repairs in a MIG, then use the API methods as follows.This turns off autohealing by default.
- For a zonal MIG, use the
instanceGroupManagers.patchmethod. - For a regional MIG, use the
regionInstanceGroupManagers.patchmethod.
For example, make the following call in a zonal MIG. This turns offautohealing by default.
PATCH https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instanceGroupManagers/MIG_NAME{ "instanceLifecyclePolicy": { "defaultActionOnFailure": "DO_NOTHING" } }If autohealing is configured in the MIG and you don't want to turn offautohealing by default, use the API methods as follows to set theonFailedHealthCheck flag toREPAIR. This ensures that autohealing ofunhealthy VMs continues to work even if repairing failed VMs is turned off.
- For a zonal MIG, use the
beta.instanceGroupManagers.patchmethod. - For a regional MIG, use the
beta.regionInstanceGroupManagers.patchmethod.
For example, make the following call in a zonal MIG:
PATCH https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instanceGroupManagers/MIG_NAME{ "instanceLifecyclePolicy": { "defaultActionOnFailure": "DO_NOTHING", "onFailedHealthCheck": "REPAIR" } }Replace the following:
PROJECT_ID: yourproject ID.MIG_NAME: the name of the MIG.ZONE: the zone where the MIG is located. For aregional MIG, useregions/REGIONin the URL.
Limitations
If a MIG has any of the following, then you cannot turn off the repairs inthe MIG by setting thedefaultActionOnFailure field toDO_NOTHING:
Turn off autohealing
When you've configured an application health check in a MIG, if you don't wantthe MIG to repair any unhealthy VMs, you can turn off autohealing separately.This doesn't turn off repairs of failed VMs.
Permissions required for this task
To perform this task, you must have the followingpermissions:
compute.instanceGroupManagers.updateon the managed instance group
Console
In the Google Cloud console, go to theInstance groups page.
Click the name of the MIG in which you want to turn off autohealing.
ClickEdit.
ClickInstance lifecycle and autohealing to expand the section.
In theAutohealing section, set theOn failed health check fieldtoNo action.
ClickSave.
gcloud
To turn off autohealing in a MIG, use thebetaupdate commandand set the--action-on-vm-failed-health-check flag todo-nothing.
For example, use the following command for a zonal MIG:
gcloud beta compute instance-groups managed updateMIG_NAME \ --action-on-vm-failed-health-check=do-nothing \ --zone=ZONE
Replace the following:
MIG_NAME: the name of the MIG.ZONE: the zone where the MIG is located. For aregional MIG, use the--region=REGIONflag.
REST
To turn off autohealing in a MIG, use the API methods as follows andset the--action-on-vm-failed-health-check flag todo-nothing.
- For a zonal MIG, use the
beta.instanceGroupManagers.patchmethod. - For a regional MIG, use the
beta.regionInstanceGroupManagers.patchmethod.
For example, make the following request to turn off autohealing in azonal MIG:
POST https://compute.googleapis.com/compute/beta/projects/PROJECT_ID/zones/ZONE/instanceGroupManagers{ "instanceLifecyclePolicy": { "onFailedHealthCheck": "DO_NOTHING" }}Replace the following:
PROJECT_ID: yourproject ID.ZONE: The zone where the MIG is located. For aregional MIG, useregions/REGIONin the URL.MIG_NAME: the name of the instance group.
Turn on repairs or autohealing
By default, a MIG repairs failed VMs and, if autohealing is configured, the MIGalso repairs unhealthy VMs. If you've turned off repairs or autohealing or both,you can turn them back on again.
Permissions required for this task
To perform this task, you must have the followingpermissions:
compute.instanceGroupManagers.updateon the managed instance group
Console
In the Google Cloud console, go to theInstance groups page.
Click the name of the MIG in which you want to turn on repair.
ClickEdit.
ClickInstance lifecycle and autohealing to expand the section.
- To repair failed VMs, in theAction on failure section, set theDefault action on failure field toRepair instance.
- To repair unhealthy VMs, in theAutohealing section, set theOn failed health check field toRepair instance. If you setthis value toDefault action, then autohealing uses the samesetting that you configure for theDefault action on failurefield.
After you finish, clickSave to apply the changes.
gcloud
To turn on repairs in a MIG, use theupdate command.This also turns on autohealing, if the value of the--action-on-vm-failed-health-check flag isdefault-action.
gcloud compute instance-groups managed updateMIG_NAME \ --default-action-on-vm-failure=repair
If you've turned off autohealing separately and you want to turn it back onagain, use thebetaupdate command:
gcloud beta compute instance-groups managed updateMIG_NAME \ --action-on-vm-failed-health-check=default-actionORrepair
Replace the following:
MIG_NAMEwith the name of a MIG.default-actionORrepair: If youwant autohealing to use the same setting that you configure for repairs offailed VMs, set the value todefault-action. For example, when you turnoff repairing of failed VMs, the MIG turns off autohealing also. If youwant to control repairs of unhealthy VMs separately, set the value torepair.
REST
To turn on repairs in a MIG, use the API method as follows. This also turnson autohealing, if the value of theonFailedHealthCheck field isDEFAULT_ACTION.
- For a zonal MIG, use the
instanceGroupManagers.patchmethod. - For a regional MIG, use the
regionInstanceGroupManagers.patchmethod.
For example, make the following request in a zonal MIG:
PATCH https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instanceGroupManagers/MIG_NAME { "instanceLifecyclePolicy": { "defaultActionOnFailure": "REPAIR" } }If you've turned off autohealing separately and you want to turn it back onagain, use the beta API method as follows:
- For a zonal MIG, use the
beta.instanceGroupManagers.patchmethod. - For a regional MIG, use the
beta.regionInstanceGroupManagers.patchmethod.
PATCH https://compute.googleapis.com/compute/beta/projects/PROJECT_ID/zones/ZONE/instanceGroupManagers/MIG_NAME { "instanceLifecyclePolicy": { "onFailedHealthCheck": "DEFAULT_ACTION ORREPAIR" } }Replace the following:
PROJECT_ID: yourproject ID.ZONE: the zone where your MIG is located. For aregional MIG, useregions/REGIONin the URL.MIG_NAME: the name of the MIG.DEFAULT_ACTIONORREPAIR: If youwant autohealing to use the same setting as for repairs of failed VMs,set the value toDEFAULT_ACTION. For example, when you turn offrepairing of failed VMs, the MIG turns off autohealing also. If you wantto configure autohealing separately, set the value toREPAIR.
What's next
- Check the repair configuration in a MIG.
- Investigate the errors in a failed VM bylisting instance errors.
- Inspect the health state of a VM.
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 2025-12-15 UTC.