Description
Ensure that Managed Instance Groups (MIGs) have autohealing configured with a valid application-level health check, so that unhealthy instances are automatically detected and recreated.
Rationale
Without autohealing, a Managed Instance Group only replaces instances that fail infrastructure-level checks (such as the VM being completely down), but it will not detect or recover instances whose application or service has hung, crashed, or become unresponsive while the VM itself remains running. A valid autohealing health check allows the group to detect application-level failures and automatically recreate the affected instance, improving service availability without manual intervention.
Impact
Automatically detects and remediates application-level failures on individual instances
Reduces manual operational overhead for maintaining group health
Requires a properly tuned health check and initial delay to avoid unnecessary instance churn from false positives
Default Value
By default, Managed Instance Groups do not have autohealing configured; instances are only replaced based on the group's basic infrastructure-level status unless a health check policy is explicitly added.
Pre-Requisites
An application-level health check resource configured to accurately reflect instance health
IAM permissions to edit Managed Instance Group configuration (e.g., Compute Instance Admin)
Test Plan
Sign in to the Google Cloud Console at https://console.cloud.google.com.
Select the relevant project.
Navigate to Compute Engine > Instance groups and select the group to review.
Open the Health checks / Autohealing section of the group's configuration.
Verify that a health check is assigned and that it targets the correct port and path for the application.
Verify the Initial delay is appropriate for the application's startup time.
If no health check is configured, follow the implementation steps.
Implementation Steps
Sign in to the Google Cloud Console at https://console.cloud.google.com.
Navigate to Compute Engine > Health checks and create a health check appropriate to the application (protocol, port, path, and thresholds).
Navigate to Compute Engine > Instance groups and select the group to update.
Select Edit group.
Under Autohealing, select the health check created above and set an appropriate Initial delay.
Click Save to apply the configuration.
Monitor the group after the change to confirm instances are not being unnecessarily recreated due to an overly strict health check.
Backout Plan
Sign in to the Google Cloud Console at https://console.cloud.google.com.
Navigate to Compute Engine > Instance groups and select the affected group.
Select Edit group.
Under Autohealing, set the health check back to None (or its previous value).
Click Save to apply the change.
Reference