What is a Google Cloud managed instance group, and how do you operate one?
A managed instance group (MIG) in Google Cloud Compute Engine creates and manages multiple VMs as a group from an instance template. You can add autoscaling, autohealing, distribution across zones, and gradual updates, making MIGs useful for fleets of similar servers such as web front ends or workers. A MIG does not by itself replicate application data or guarantee a zero-downtime deployment. You must design where state lives, what each health check means, and how much capacity may be unavailable during an update. ([Google Cloud: instance groups](https://docs.cloud.google.com/compute/docs/instance-groups), [regional MIGs](https://docs.cloud.google.com/compute/docs/instance-groups/regional-migs))
What is a Google Cloud managed instance group, and how do you operate one?
A managed instance group (MIG) in Google Cloud Compute Engine creates and manages multiple VMs as a group from an instance template. You can add autoscaling, autohealing, distribution across zones, and gradual updates, making MIGs useful for fleets of similar servers such as web front ends or workers. A MIG does not by itself replicate application data or guarantee a zero-downtime deployment. You must design where state lives, what each health check means, and how much capacity may be unavailable during an update. (Google Cloud: instance groups, regional MIGs)
How does a MIG manage multiple VMs?
An instance template defines shared VM creation settings such as machine type, boot disk image, network, and service account. The MIG uses that template and a target instance count to create VMs and reconcile the group's current state with its declared goal. Instead of changing each VM individually, you set size, health checking, and update policies at group level.
For example, if a web service template specifies the same application version and startup settings and the MIG target size is six, the group tries to maintain six VMs with that configuration. A load balancer can send traffic to healthy instances, but load-balancer and MIG health checks serve different purposes. A load-balancer check removes an unresponsive VM from traffic; a MIG autohealing check can cause an unhealthy VM to be recreated. Choose carefully whether recreation is appropriate. (Google Cloud: instance groups and health checks)
Should you choose a zonal or regional MIG?
A zonal MIG manages VMs in one zone. A regional MIG places VMs across multiple zones in the same region, giving instances in remaining zones a chance to keep serving if one zone has a problem. Regional placement improves compute-layer resilience to a zone failure, but it does not automatically solve database replication, storage availability, or a region-wide outage. Check per-zone quotas and the VM resources needed to distribute capacity. (Google Cloud: regional MIGs)
Putting VMs in different zones alone does not make a service highly available. Keep state in externally replicated storage and verify that the load balancer and application tolerate instance replacement. Workloads that require unique disks or metadata per VM can consider stateful MIG configuration, but a stateful MIG does not replace database consistency or application recovery procedures. (Google Cloud: stateful MIGs)
What controls autoscaling and autohealing?
Autoscaling adds or removes VMs based on signals such as CPU utilization, load-balancing capacity, Cloud Monitoring metrics, or schedules. Signals should match the real bottleneck. For example, scaling a queue worker only on CPU might not add enough capacity when the queue grows but CPU remains low. Set minimum and maximum instance counts and account for startup time to manage cost and the risk of abrupt scale-in. (Google Cloud: autoscaling instance groups)
Autohealing can recreate a VM when a MIG health check marks it unhealthy. If the check is too sensitive, transient delay can trigger repeated replacements; if too lenient, a real failure can go undetected for too long. Decide whether the check tests that a process is running or that it can serve user requests, and determine how application data survives recovery.
How can you roll out a template change safely?
Attaching a new template to an existing MIG does not necessarily change every existing VM immediately. An automatic update policy can apply the configuration gradually, with controls for simultaneous unavailability, extra instances, and readiness wait time. A canary update applies the new version to a small subset first so you can observe errors and metrics before expanding the rollout. (Google Cloud: automatically updating MIGs)
For example, you might put the new template on one of six instances, check request success and error rates plus startup logs, and then expand to the rest. This is an illustrative scenario. A successful response to an update request does not prove rollout completion. Check whether the group reached the target template and is stable, and inspect service-level metrics separately. If the update is unhealthy, stop the remaining rollout and use a documented procedure to return to the prior template.
What workloads fit, and what must you manage separately?
A MIG is useful when you need to maintain many similarly configured VMs and respond repeatedly to changing load, VM failures, or software updates. It fits especially well for web servers and stateless APIs whose requests can move between instances. Repeated manual changes through individual VM logins can make the live VMs diverge from the template, and those changes may disappear during repair or replacement; operate from reproducible templates and deployment processes.
A MIG does not replace a load balancer, application data replication, backups, IAM, or monitoring. If state exists only on local disks or an external dependency is a single point of failure, adding VMs will not prevent service outages. Review the recovery boundary for both data and application, and verify that updates and repairs actually completed using group status and service metrics.
Official documentation
[Google Cloud: instance groups](https://docs.cloud.google.com/compute/docs/instance-groups)
[Google Cloud: regional MIGs](https://docs.cloud.google.com/compute/docs/instance-groups/regional-migs)
[Google Cloud: stateful MIGs](https://docs.cloud.google.com/compute/docs/instance-groups/stateful-migs)
[Google Cloud: autoscaling](https://docs.cloud.google.com/compute/docs/autoscaler)
[Google Cloud: automatic MIG updates](https://docs.cloud.google.com/compute/docs/instance-groups/rolling-out-updates-to-managed-instance-groups)