Create a MIG with autoscaling enabled
Stay organized with collections
Save and categorize content based on your preferences.
This document describes how to create an autoscaled
managed instance group (MIG)
that automatically adds and removes VMs based on average CPU utilization across
the group. For example, if the group's CPU utilization is low, the group
automatically removes VMs to save on costs.
You can automatically scale a MIG based on various kinds of autoscaling signals.
For more information, see the autoscaler overview.
If you haven't already, set up authentication.
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:
To use the Terraform samples on this page in a local development environment, install and
initialize the gcloud CLI, and then set up Application Default Credentials with
your user credentials.
Set up application-based autohealing,
which periodically verifies that your application responds as expected on
each of the MIG's VMs and automatically recreates unresponsive VMs.
Learn how to
apply a new configuration
to all or to a subset of the VMs in a MIG by setting and applying a new
instance template, all-instances configuration, or per-instance configuration.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-07-17 UTC."],[],[]]