Using an autoscaling policy with multiple signals

When you create an autoscaling policy with multiple signals, the autoscalerscales based on the signal that provides the largest number of virtual machine(VM) instances in the managed instance group (MIG). This ensures that thereare always enough VMs to handle your application workloads and lets youscale applications with multiple possible bottlenecks.

To learn more about the different types of autoscaling signals,seeAutoscaling policy.

Before you begin

How autoscaler handles multiple signals

An autoscaler handles multiple signals by calculating the recommended number ofVMs for each signal and then picking the signal that results in the largestnumber of VMs in the MIG.

An autoscaler can handle one signal per metric type except in the case ofCloud Monitoring metrics and scaling schedules.You can choose up to 5 autoscaling signals for Cloud Monitoringmetrics and create up to 128 schedulesper MIG. For example, you can create an autoscaler thatuses up to 1 CPU utilization signal, up to 1 load balancing signal, up to 5custom metric signals, and up to 128 scaling schedules.

For example, you can define an autoscaler with all of the followingsignals:

  • cpuUtilization with target of 0.8
  • loadBalancingUtilization with target of 0.6
  • customMetricUtilization for metric1 with target of 1000
  • customMetricUtilization for metric2 with target of 2000
  • scalingSchedules
    • A minimum of 6 VMs every Saturday and Sunday at 12:00 AM for 24 hours
    • A minimum of 15 VMs every Monday through Friday at 9:00 AM for 8 hours

In this example, suppose the autoscaler measures the following averageutilization values for a MIG that contains 10 VMsat the time of measurement:

  • 0.5 for CPU utilization
  • 0.4 load balancing utilization
  • 1100 for metric1
  • 2700 for metric2

Using the preceding values, the autoscaler calculates the recommended number ofVMs based on each signal:

  • 7 VMs based on CPU utilization
  • 7 VMs based on load balancing utilization
  • 11 VMs based on metric1
  • 14 VMs based on metric2
  • 6 VMs every Saturday and Sunday for the entire day based on the first scaling schedule
  • 15 VMs every Monday through Friday from 9:00 AM to 5:00 PM based on the second scaling schedule

The autoscaler picks the signal that results in the largest number of VMs in theMIG and sets the MIG'srecommended sizeto that value. In this case, the autoscaler resizes the MIGto 15 VMs if the second schedule is currently active or to 14 VMs otherwise.

Create an autoscaler with multiple signals

Creating an autoscaler with multiple signals is slightly different dependingon whether you are using the Google Cloud console, gcloud CLI,or REST.

Permissions required for this task

To perform this task, you must have the followingpermissions:

  • To create a new autoscaler for an existing MIG:
    • compute.autoscalers.create on the project
    • compute.instanceGroupManagers.use on the MIG
  • To edit an existing autoscaler:
    • compute.autoscalers.update on the project

Console

  1. In the Google Cloud console, go to theInstance groups page.

    Go to Instance groups

  2. Click the name of a MIG from the list.

  3. ClickEdit.

  4. ClickGroup size & autoscaling to expand the section.

  5. In theAutoscaling mode list, make sure thatOn: add and remove instances to the group is selected.

  6. In theMinimum number of instances field, enter the minimum numberof VMs that you want for this MIG. The minimum size of this MIG isalways maintained regardless of its autoscaling signals.

  7. In theMaximum number of instances field, enter the maximum numberof VMs that you want for this MIG. The maximum size of this MIG is neverexceeded regardless of the recommended size generated by its autoscalingsignals.

  8. For eachmetric-based autoscaling signalthat you want to add, clickAdd a signal.

    • To create an autoscaling signal based on average CPU utilization,in theSignal type list, selectCPU utilization. Then, enteraTarget CPU utilization and clickDone.For more information, seeScaling based on CPU utilization.
    • To create an autoscaling signal based on HTTP load balancing servingcapacity, in theSignal type list, selectHTTP load balancing utilization. Then, enter aTarget HTTP load balancing utilization andclickDone. For more information, seeScaling based on load balancing serving capacity.
    • To create an autoscaling signal based on Cloud Monitoring metrics,in theSignal type list, selectCloud Monitoring metric. Then,complete the remaining fields and clickDone. For moreinformation, seeScaling based on Cloud Monitoring metrics.
  9. For each schedule-based autoscaling signal that you want to add, in theAutoscaling schedules section, clickManage.

    1. ClickCreate schedule.

    2. In theCreate scaling schedule pane, complete the requiredfields, and then clickSave.

    3. In theScaling schedules pane, clickDone.

    For more information, seeScaling based on schedules.

  10. In theInitialization period section, enter the number of secondsthat your application needs to initialize. This period lets your VMsfinish initializing before the autoscaler considers its usage datareliable. For more information, seeInitialization period.

  11. Optional: to enable scale-in controls, in theScale-in controlssection, select theEnable scale-in controls checkbox. For moreinformation, seescale-in controls

  12. ClickSave.

gcloud

To create an autoscaler with multiple signals, use theset-autoscaling command.Pass in multiple signal specifications using their respectivecommand-line flags.

For example, the following command createsan autoscaler that uses CPU utilization, load balancing serving capacity,two custom metrics, and one scaling schedule. The--max-num-replicas and--min-num-replicas flags restrict how bigor small the MIG can get.

gcloud compute instance-groups managed set-autoscalingMIG_NAME \   --target-cpu-utilization=0.8 \   --target-load-balancing-utilization=0.6 \   --custom-metric-utilization metric=PATH_TO_CUSTOM_METRIC_1,utilization-target=1000.0,utilization-target-type=GAUGE \   --custom-metric-utilization metric=PATH_TO_CUSTOM_METRIC_2,utilization-target=2000.0,utilization-target-type=DELTA_PER_SECOND \   --set-schedule=workday-capacity \   --schedule-cron="30 8 * * Mon-Fri" \   --schedule-duration-sec=30600 \   --schedule-min-required-replicas=10 \   --schedule-description="Have at least 10 VMs every Monday through Friday from 8:30 AM to 5 PM UTC" \   --min-num-replicas=1 \   --max-num-replicas=50

Replace the following:

  • MIG_NAME: the name of a MIG.
  • PATH_TO_CUSTOM_METRIC_1 andPATH_TO_CUSTOM_METRIC_2: Optional: the paths tocustom metrics with a format similar tocustom.cloudmonitoring.googleapis.com/path/to/metric1 andcustom.cloudmonitoring.googleapis.com/path/to/metric2. For moreinformation, seeCustom metrics.

With the exception of the custom metric flags, you can only pass in one flagmaximum for each metric type pergcloud command. For custom metrics, youcan provide multiple custom metrics in a single command by repeatingthe--custom-metric-utilization flag.

For more information about how to configure the flags for each type ofautoscaling signal, see the following pages:

REST

To create an autoscaler, use theautoscalers.insert methodfor a zonal MIG or theregionAutoscalers.insert methodfor a regional MIG.

For example, the following request creates anautoscaler that uses CPU utilization, load balancingserving capacity, two custom metrics, and two scaling schedules. ThemaxNumReplicas andminNumReplicas fields restrict how big orsmall the MIG can get.

POST https://compute.googleapis.com/compute/v1/projects/PROJECT/zones/ZONE/autoscalers{  "autoscalingPolicy" : {    "cpuUtilization":{      "utilizationTarget": 0.8    },    "loadBalancingUtilization":{      "utilizationTarget": 0.6    },    "customMetricUtilizations":[      {        "metric": "PATH_TO_CUSTOM_METRIC_1",        "utilizationTarget": 1000,        "utilizationTargetType":"GAUGE"      },      {        "metric": "PATH_TO_CUSTOM_METRIC_2",        "utilizationTarget": 2000,        "utilizationTargetType": "DELTA_PER_SECOND"      }    ],    "scalingSchedules": {      "workday-capacity": {        "minRequiredReplicas": 10,        "schedule": "30 8 * * Mon-Fri",        "durationSec": 30600,        "description": "Have at least 10 VMs every Monday through Friday from 8:30 AM to 5 PM UTC"      },      "january-30-2030-schedule": {        "minRequiredReplicas": 30,        "schedule": "0 0 30 1 * 2030",        "timeZone": "America/New_York",        "durationSec": 86400,        "description": "Schedule a minimum of 30 VMs all day for January 30, 2030"      }    },    "maxNumReplicas": 50,    "minNumReplicas": 1  },  "target": "https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-a/instanceGroupManagers/MIG_NAME",  "name": "MIG_NAME"}

Replace the following:

  • PROJECT: yourproject id.
  • ZONE: the zone where your MIG is located.
  • MIG_NAME: the name of a MIG.
  • PATH_TO_CUSTOM_METRIC_1 andPATH_TO_CUSTOM_METRIC_2: Optional: the paths tocustom metrics with a format similar tocustom.cloudmonitoring.googleapis.com/path/to/metric1 andcustom.cloudmonitoring.googleapis.com/path/to/metric2. For moreinformation, seeCustom metrics.

As shown in this example, you can provide multiple custom metrics andscaling schedules in the same request.

For more information about how to configure the fields for each type ofautoscaling signal, see the following pages:

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 2026-02-18 UTC.