Configure autoscaling in a managed instance group (MIG)

Configure autoscaling based on CPU utilization in a zonal MIG.

Explore further

For detailed documentation that includes this code sample, see the following:

Code sample


To learn how to apply or remove a Terraform configuration, see Basic Terraform commands. For more information, see the Terraform provider reference documentation.

resource "google_compute_autoscaler" "default" {
  name   = "example-autoscaler"
  zone   = "us-central1-f"
  target =

  autoscaling_policy {
    max_replicas    = 20
    min_replicas    = 0
    cooldown_period = 90

    cpu_utilization {
      target = 0.60

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.