Description
Ensure that Managed Instance Groups (MIGs) serving application traffic are attached to a backend service used by a load balancer, so that traffic is distributed across healthy instances and requests are not routed to a single instance directly.
Rationale
A Managed Instance Group that is not attached to a load balancer does not benefit from health-check-based traffic distribution, meaning traffic may continue to be directed at an unhealthy or overloaded instance, or clients may need to target instances individually. Attaching the group to a load balancer's backend service enables even traffic distribution, automatic exclusion of unhealthy instances from serving traffic, and supports scaling the group without reconfiguring clients.
Impact
Distributes incoming traffic evenly across healthy instances in the group
Automatically stops routing traffic to instances that fail load balancer health checks
Enables the group to scale without requiring changes to how clients connect
Default Value
By default, a newly created Managed Instance Group is not attached to any load balancer backend service; this must be configured explicitly.
Pre-Requisites
A configured load balancer (HTTP(S), TCP/SSL Proxy, or Network Load Balancer) with a backend service
A health check appropriate for the load balancer type
IAM permissions to edit load balancing and instance group configuration (e.g., Compute Load Balancer Admin, Compute Instance Admin)
Test Plan
Sign in to the Google Cloud Console at https://console.cloud.google.com.
Select the relevant project.
Navigate to Network services > Load balancing and review the backend services configured.
Confirm that the Managed Instance Group in question appears as a backend in the relevant backend service.
Navigate to Compute Engine > Instance groups and confirm the group shows an associated load balancer usage indicator.
If the group serving application traffic is not attached to a backend service, follow the implementation steps.
Implementation Steps
Sign in to the Google Cloud Console at https://console.cloud.google.com.
Navigate to Network services > Load balancing and create or edit the appropriate load balancer for the workload's traffic type.
In the backend configuration, select Create/Add backend and choose the Managed Instance Group.
Select the appropriate port name/number and attach a health check.
Complete and save the load balancer / backend service configuration.
Verify in Compute Engine > Instance groups that the group now shows as attached to the load balancer, and confirm instances are reporting healthy in the backend service.
Backout Plan
Sign in to the Google Cloud Console at https://console.cloud.google.com.
Navigate to Network services > Load balancing and select the relevant backend service.
Remove the Managed Instance Group from the backend configuration.
Save the change.
Reference