Instance groups

An instance group is a collection of virtual machine (VM) instances that you canmanage as a single entity.

Compute Engine offers two kinds of VM instance groups, managed andunmanaged:

  • Managed instance groups (MIGs) let you operate apps onmultiple identical VMs. You can make your workloads scalable and highlyavailable by taking advantage of automated MIG services, including:autoscaling, autohealing, regional (multiple zone) deployment, and automaticupdating.

  • Unmanaged instance groups let you load balance across a fleet of VMsthat you manage yourself.

Try it for yourself

If you're new to Google Cloud, create an account to evaluate how Compute Engine performs in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.

Try Compute Engine free

Managed instance groups (MIGs)

Use a managed instance group (MIG) for scenarios like these:

  • Stateless serving workloads, such as a website frontend
  • Stateless batch, high-performance, or high-throughput compute workloads, suchas image processing from a queue
  • Stateful applications, such as databases, legacy applications, andlong-running batch computations with checkpointing

Compute Engine maintains each of the MIG'smanaged instancesbased on the configuration that you specify in aninstance template and optionalstateful configuration.

For information about how to create a MIG, seeCreating managed instance groups.

Benefits

MIGs offer the following advantages:

  • High availability.
    • Automatically repairing failed VMs. If a VM in the group stops,crashes, gets preempted (Spot VMs),or is deleted by an action not initiated by the MIG, theMIG automatically recreates that VM based on its originalconfiguration (same VM name, same template) so that theVM can resume its work.
    • Application-based autohealing. You can also set up anapplication-based health check, which periodically verifies that yourapplication responds as expected on each of the MIG's instances. If anapplication is not responding on a VM, the MIG automaticallyrecreates that VM for you. Checking that an application responds is moreprecise than simply verifying that a VM is up and running.
    • Regional (multiple zone) coverage. Regional MIGslet you spread app load across multiple zones. Thisreplication protects against zonal failures. If that happens, yourapp can continue serving traffic from instances running in theremaining available zones in the same region.
    • Load balancing. MIGs work with load balancingservices to distribute traffic across all of the instances in the group.
  • Scalability. When your apps require additional compute resources,autoscaled MIGs can automatically grow the number of instances in the group tomeet demand. If demand drops, autoscaled MIGs can automatically shrink toreduce your costs.
  • Automated updates. The MIG automatic updater lets yousafely deploy new versions of software to instances in your MIG andsupports a flexible range of rollout scenarios, such as rolling updates andcanary updates. You can control the speed and scope of deployment as well asthe level of disruption to your service.
  • Support for stateful workloads. You can use MIGs forbuilding highly available deployments and automating operation of applicationswith stateful data or configuration, such as databases, DNS servers, legacymonolith applications, or long-running batch computations with checkpointing.Stateful MIGs preserve each instance's unique state (instance name, attachedpersistent disks, and metadata) on machine restart, recreation, auto-healing,and update events.
  • Create GPU VMs all at once. When you have a batch job, such as an AI or MLtraining, that requires an exact number of GPU VMs, then creating a resizerequest in a MIG can help you to create the VMs all at once. You can specifythe duration for which you want the VMs to run for, thereby improving theobtainability of highly-demanded resources such as GPUs.
Use a managed instance group to build highly available deployments            for stateless serving, stateful applications, or batch workloads.
Overview of MIG capabilities and common workloads

Automatic repair and autohealing

Managed instance groups maintain high availability of your applications byproactively keeping your instances available. AMIG automatically repairs failed instances by recreating them.

You might also want to repair instances when an application freezes, crashes, orruns out of memory. Application-based autohealing improves applicationavailability by relying on a health checking signal that detectsapplication-specific issuessuch as freezing, crashing, or overloading. If a health check determines that anapplication has failed on a VM, the group automatically recreates that VMinstance.

For more information, seeAbout repairing VMs in a MIG.

Health checking

The health checks used to monitor MIGs are similar to thehealth checks used for load balancing, with some differences in behavior.Loadbalancing health checks help directtraffic away from non-responsive instances and toward healthy instances; thesehealth checks do not cause Compute Engine to recreate instances. Onthe other hand,managed instance group health checksproactively signal to delete and recreate instances that becomeUNHEALTHY.

For the majority of scenarios, use separate health checks for load balancingand for autohealing. Health checking for load balancing can and should be moreaggressive because these health checks determine whether an instance receivesuser traffic. Because customers might rely on your services, you want to catchnon-responsive instances quickly so you can redirect traffic if necessary. Incontrast, health checking for autohealing causes MIGs toproactively replace failing instances, so this health check should be moreconservative than a load balancing health check.

For more information, seeSet up an application health check and autohealing.

Regional or zonal groups

You can create two types of MIGs:

  • Azonal MIG,which deploys instances to a single zone.
  • Aregional MIG,which deploys instances to multiple zones across the same region.

Both types offer all of theadvantages of MIGs.Regional MIGs add higher availability by spreading application load acrossmultiple zones, which protects your workload against zonal failure, and regionalMIGs offer more capacity. By default, you can create up to 2,000 VMs in aregional MIG and 1,000 VMs in a zonal MIG. If you need more VMs, you canincrease the size limit of your MIG orcontact support.

Load balancing

Google Cloud load balancing can use instance groups to serve traffic.Depending on the type of load balancer youchoose, you can add instancegroups to a target pool or to a backend service.

For more information, seeAdding an instance group to a load balancer.

Autoscaling

MIGs support autoscaling that dynamically adds or removes VM instances from thegroup in response to increases or decreases in load. You can configure anautoscaling policy to specify how you want to scale the group. In yourautoscaling policy, you can set one or more signals to scale the group based onCPU utilization, load balancing capacity, Cloud Monitoring metrics,schedules, or, for zonal MIGs, by using a queue-based workload likePub/Sub.

For more information, readAutoscaling groups of instances.

Automatic updating

You can easily and safely deploy new versions of software to instances in aMIG. The rollout of an update happens automatically basedon your specifications: you can control the speed and scope of the updaterollout in order to minimize disruptions to your application. You can optionallyperform partial rollouts, which allows for canary testing.

SeeUpdating MIGs.

Support for stateful workloads

You can build highly available deployments of stateful workloadson VMs using stateful managed instance groups (stateful MIGs). Statefulworkloads include applications with stateful data or configuration, such asdatabases, legacy monolith applications, and long-running batch computationswith checkpointing.

You can improve uptime and resiliency of such applications withautohealing,controlled updates,andmulti-zone deployments, while preserving eachinstance's unique state, including customizable instance name, persistent disks,and metadata.

For more information, readStateful MIGs.

Create GPU VMs all at once

You can create a resize request in a MIG withGPU VMs to create therequested VMs all at once when the requested capacity becomes available. Whenyou create a resize request in a MIG, Compute Engine schedules thecreation of the VMs based on the number of requested VMs, their requested runduration, and the availability of the requested resources in the zones of theMIG. Then, at the scheduled delivery of the resources, the MIG creates therequested number of VMs all at once. The VMs run until the end of their runduration or until you delete them.

For more information, seeAbout resize requests in a MIG.

Groups of preemptible instances

For workloads where minimal costs are more important than speed of execution,you can reduce the cost of your workload by usingpreemptible VM instancesin your instance group. Preemptible instances last up to 24 hours, and arepreempted gracefully—your application has 30 seconds to exit correctly.Preemptible instances can be deleted at any time, but autohealing will bring theinstances back when preemptible capacity becomes available again.

Containers

You can simplify application deployment by deploying containers to instances inmanaged instance groups. When you specify a container imagein an instance template and then use that template to create a managed instancegroup, each VM is created with a container-optimized OS that includesDocker, and your container starts automatically on each VM in thegroup. SeeDeploying containers on VMs and MIGs.

Network and subnet

When you create a managed instance group, you must reference an existinginstance template. The instance template defines the VPC networkand subnet that member instances use. If you omit a VPC network,Google Cloud attempts to use the VPC network nameddefault and the automatically-created subnet in the region specified inthe template.

For more information, seeNetworks andsubnets.

If you want your managed instance group to include VM instances that use IPv6addressing, you must use either the dual-stack or IPv6-only settingwhen you create your instance template. For more information, seeCreate an instance template with IPv6 addresses.

Demo of MIG capabilities

The following 45-minute video presentation, recorded at Google Cloud NEXT'18, contains demos and best practices for setting up, running, and updatingscalable and highly available deployments using Compute Engine MIGs.

The video shows you how to deploy a container to a MIG, set up an autohealingpolicy, use a regional group to protect against a zonal failure,configure autoscaling to meet CPU targets and queue-based demands, and managecanary and rolling updates.

Unmanaged instance groups

Unmanaged instance groups can contain heterogeneous instances that you canarbitrarily add and remove from the group. Unmanaged instance groups do notoffer autoscaling, autohealing, rolling update support, multi-zone support, orthe use of instance templates and are not a good fit for deploying highlyavailable and scalable workloads. Use unmanaged instance groups if you need toapplyload balancing to groups ofheterogeneous instances, or if you need to manage the instances yourself. Youcan add up to 2,000 VMs to a group. If you want to add more than 2,000 VMs tothe group,contact support.

If you must create unmanaged instance groups, seeUnmanaged instance groups.

Pricing

There is no additional charge for using managed or unmanaged instance groups.You are charged based on the resources that your group uses.For Compute Engine pricing information, seePricing.

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 2025-12-15 UTC.