Creates an region autoscaler.


google::compute-region-autoscaler region-autoscaler-example
    name: "region-autoscaler-example"
    description: "Region autoscaler example"

        cool-down-period-sec: 70
        max-num-replicas: 5

    instance-group-manager: $(google::compute-region-instance-group-manager region-instance-group-manager-example)
    region: "us-central1"


Attribute Description

Name of the resource.

The name must be 1-63 characters long, and comply with RFC1035. Must be a string 1-63 characters long and match the regular expression [a-z](?:[-a-z0-9]{0,61}[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. Valid values satisfy the regex: [[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?]. (Required)

autoscaling-policy subresource

The configuration parameters for the autoscaling algorithm.

You can define one or more of the policies for an autoscaler:

  • cpu-utilization
  • custom-metric-utilizations
  • load-balancing-utilization

If none of these are specified, the default will be to autoscale based on cpu-utilization to 0.6 or 60%. (Required)


The number of seconds that the autoscaler should wait before it starts collecting information from a new instance.

This prevents the autoscaler from collecting information when the instance is initializing, during which the collected usage would not be reliable. The default time autoscaler waits is 60 seconds. Virtual machine initialization times might vary because of numerous factors. We recommend that you test how long an instance may take to initialize. To do this, create an instance and time the startup process.

cpu-utilization subresource

Defines the CPU utilization policy that allows the autoscaler to scale based on the average CPU utilization of a managed instance group.


The target CPU utilization that the autoscaler should maintain.

Must be a float value in the range between 0 and 1. If not specified, the default is 0.6. If the CPU level is below the target utilization, the autoscaler scales down the number of instances until it reaches the minimum number of instances you specified or until the average CPU of your instances reaches the target utilization. If the average CPU is above the target utilization, the autoscaler scales up until it reaches the maximum number of instances you specified or until the average utilization reaches the target utilization. Valid values are between 0 to 1. (Required)

custom-metric-utilization list subresource

Configuration parameters of autoscaling based on a custom metric.


The identifier (type) of the Stackdriver Monitoring metric.

The metric cannot have negative values. The metric must have a value type of INT64 or DOUBLE. (Required)


The target value of the metric that autoscaler should maintain.

A utilization metric scales number of virtual machines handling requests to increase or decrease proportionally to the metric. For example, a good metric to use as a utilization_target is The autoscaler will work to keep this value constant for each of the instances. Minimum allowed value is 0. (Required)


Defines how target utilization value is expressed for a Stackdriver Monitoring metric.


load-balancing-utilization subresource

Configuration parameters of autoscaling based on load balancer.


Fraction of backend capacity utilization (set in HTTP(S) load balancing configuration) that autoscaler should maintain.

Must be a positive float value. If not defined, the default is 0.8. Valid values are between 0 to 1. (Required)


The maximum number of instances that the autoscaler can scale up to.

The maximum number of replicas should not be lower than minimal number of replicas. (Required)


The minimum number of replicas that the autoscaler can scale down to.

If not provided, autoscaler will choose a default value depending on maximum number of instances allowed. Minimum allowed value is 0.

Operating mode for this policy. Valid values are OFF, ON or ONLY_UP.
description A description of this resource.
instance-group-manager resource

The managed instance group that this autoscaler will scale. (Required)

region The region where the autoscaler resides. (Required)


Attribute Description

Target recommended MIG size (number of instances) computed by autoscaler.

Autoscaler calculates recommended MIG size even when autoscaling policy mode is different from ON. This field is empty when autoscaler is not connected to the existing managed instance group or autoscaler did not generate its prediction.

self-link Server-defined URL for the resource.

The status of the autoscaler configuration.

Current set of possible values:

  • PENDING: Autoscaler backend hasn’t read new/updated configuration.
  • DELETING: Configuration is being deleted.
  • ACTIVE: Configuration is acknowledged to be effective. Some warnings might be present in the status-detail field.
  • ERROR: Configuration has errors. Actionable for users. Details are present in the status-detail field. Valid values are PENDING, DELETING, ACTIVE or ERROR.
status-detail list subresource

Human-readable details about the current state of the autoscaler.

The status message.

The type of error, warning, or notice returned.

Current set of possible values:

  • ALL_INSTANCES_UNHEALTHY (WARNING): All instances in the instance group are unhealthy (not in RUNNING state).
  • BACKEND_SERVICE_DOES_NOT_EXIST (ERROR): There is no backend service attached to the instance group.
  • CAPPED_AT_MAX_NUM_REPLICAS (WARNING): Autoscaler recommends a size greater than maxNumReplicas.
  • CUSTOM_METRIC_DATA_POINTS_TOO_SPARSE (WARNING): The custom metric samples are not exported often enough to be a credible base for autoscaling.
  • CUSTOM_METRIC_INVALID (ERROR): The custom metric that was specified does not exist or does not have the necessary labels.
  • MIN_EQUALS_MAX (WARNING): The minNumReplicas is equal to maxNumReplicas. This means the autoscaler cannot add or remove instances from the instance group.
  • MISSING_CUSTOM_METRIC_DATA_POINTS (WARNING): The autoscaler did not receive any data from the custom metric configured for autoscaling.
  • MISSING_LOAD_BALANCING_DATA_POINTS (WARNING): The autoscaler is configured to scale based on a load balancing signal but the instance group has not received any requests from the load balancer.
  • MODE_OFF (WARNING): Autoscaling is turned off. The number of instances in the group won’t change automatically. The autoscaling configuration is preserved.
  • MODE_ONLY_UP (WARNING): Autoscaling is in the “Autoscale only up” mode. The autoscaler can add instances but not remove any.
  • MORE_THAN_ONE_BACKEND_SERVICE (ERROR): The instance group cannot be autoscaled because it has more than one backend service attached to it.
  • NOT_ENOUGH_QUOTA_AVAILABLE (ERROR): There is insufficient quota for the necessary resources, such as CPU or number of instances.
  • REGION_RESOURCE_STOCKOUT (ERROR): Shown only for regional autoscalers: there is a resource stockout in the chosen region.
  • SCALING_TARGET_DOES_NOT_EXIST (ERROR): The target to be scaled does not exist.
  • UNSUPPORTED_MAX_RATE_LOAD_BALANCING_CONFIGURATION (ERROR): Autoscaling does not work with an HTTP/S load balancer that has been configured for maxRate.
  • ZONE_RESOURCE_STOCKOUT (ERROR): For zonal autoscalers: there is a resource stockout in the chosen zone. For regional autoscalers: in at least one of the zones you’re using there is a resource stockout.