Configure autoscaling based on CPU utilization in a zonal MIG.

## Explore further


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

- [Create a MIG with autoscaling enabled](https://docs.cloud.google.com/compute/docs/instance-groups/create-mig-with-basic-autoscaling)

## Code sample

### Terraform


To learn how to apply or remove a Terraform configuration, see
[Basic Terraform commands](https://docs.cloud.google.com/docs/terraform/basic-commands).


For more information, see the
[Terraform provider reference documentation](https://registry.terraform.io/providers/hashicorp/google/latest/docs).

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

      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](https://docs.cloud.google.com/docs/samples?product=computeengine).