All Products
Search
Document Center

Auto Scaling:How Auto Scaling works

Last Updated:Apr 01, 2026

Auto Scaling monitors your scaling group and automatically adjusts the number of Elastic Compute Service (ECS) instances based on the scaling modes you configure. It manages elastic container instances the same way. This document uses ECS instances to illustrate the workflow.

Workflow

The following diagram shows the components involved when Auto Scaling adds ECS instances.

image

The diagram uses a three-tier web application as an example. A Server Load Balancer (SLB) instance at the top layer forwards client requests to ECS instances in the scaling group at the middle layer. The ECS instances process the requests, while ApsaraDB RDS instances at the bottom layer store the application data. Auto Scaling adjusts the number of ECS instances at the middle layer.

When a scaling condition is met, Auto Scaling runs the following sequence:

  1. Evaluate the scaling condition. Auto Scaling checks whether the conditions defined in your configured scaling modes are satisfied. For details on each mode, see Scaling modes.

  2. Trigger the scaling rule. Auto Scaling calls the ExecuteScalingRule API operation with the unique identifier of the target scaling rule, for example: ari:acs:ess:cn-hangzhou:140692647406**:scalingrule/asr-bp1dvirgwkoowxk7**.

    • To find the scaling rule identifier in the console, open the scaling rule list, click the ID in the Scaling Rule ID/Name column, and note the identifier on the details page (for example: asr-bp14u7kzh8442w9z****).

    • To find it via API, call DescribeScalingRules.

  3. Resolve the scaling details. Auto Scaling uses the scaling rule identifier to retrieve the associated scaling group and scaling configuration. It determines the required number of ECS instances and queries any attached SLB and ApsaraDB RDS instances. It also retrieves the instance configuration, including the required vCPUs, memory, and bandwidth.

  4. Execute the scaling activity. Auto Scaling provisions the required ECS instances based on the instance configuration source, then:

    • Adds the private IP addresses of the new instances to the ApsaraDB RDS instance whitelists.

    • Registers the new instances as backend servers for the SLB instance.

  5. Activate the cooldown period. After the scaling activity completes, Auto Scaling starts the cooldown period for the scaling group. The cooldown period prevents rapid, repeated scaling triggered by metric fluctuations, ensuring that each scaling action has time to take effect before another is evaluated. The scaling group does not process new scaling requests until the cooldown period ends.

Create a corresponding scale-in configuration for each scale-out configuration. This ensures that Auto Scaling can remove instances when demand drops, not just add them when demand rises.

Scaling modes

Auto Scaling supports six scaling modes. Each mode triggers scaling under different conditions. Choose the mode that matches your traffic pattern.

Scaling modeWhen to useConfiguration methodDescription
Fixed-quantity modeWhen your application needs a fixed floor, ceiling, or exact instance count regardless of loadScaling group + Instance configuration sourceControls instance count via three parameters: Minimum Number of Instances, Maximum Number of Instances, and (optional) Expected Number of Instances. Auto Scaling adds instances if the count falls below the minimum, removes instances if it exceeds the maximum, and adjusts to the expected count if one is set.
Health modeAlways recommended as a baseline — removes unhealthy instances automaticallyScaling group + Instance configuration sourceMonitors ECS instances at specified intervals. Unhealthy instances are automatically removed and replaced. If an SLB instance with health check enabled is attached to the scaling group, both the SLB health check and the scaling group health check run simultaneously. The SLB instance can be a Classic Load Balancer (CLB) instance or an Application Load Balancer (ALB) instance. Enable this mode by turning on Instance Health Check when configuring the scaling group.
Scheduled modeWhen demand follows a predictable schedule (for example, a daily traffic spike at noon)Scaling group + Instance configuration source + Scaling rule + Scheduled taskA scheduled task triggers a scaling rule at a designated time. For example, create a scheduled task to add 20 ECS instances at 12:00 PM daily to handle a predictable midday spike.
Dynamic modeWhen demand is unpredictable and you want to scale in response to real-time metricsScaling group + Instance configuration source + Scaling rule + Event-triggered taskAn event-triggered task monitors a CloudMonitor performance metric (such as CPU utilization). When the metric crosses the alert condition — for example, average CPU utilization across all instances exceeds 60% — Auto Scaling executes the corresponding scaling rule.
Custom modeWhen you need full manual control over instance countCustomManually execute scaling rules or add, remove, or delete ECS instances directly.
Multi-modeWhen a single mode is not enough to cover all traffic patternsCombination of the aboveCombine any of the above modes. Each mode operates independently with no priority order — Auto Scaling applies the configuration of whichever mode is triggered first. For example, if you use both scheduled and dynamic modes and the scheduled task fires before the event-triggered task, Auto Scaling executes the scheduled task first.
Combining scheduled mode with dynamic mode is a common pattern. Use a scheduled task to pre-provision instances before a known traffic spike, and use dynamic mode to handle unexpected load on top of that baseline.

Configure scaling modes

Each scaling mode requires a specific set of components. The table below maps each mode to its required components.

Scaling modeConfiguration methodRequired components
Fixed-quantity modeBasicScaling group + Instance configuration source
Health modeBasicScaling group + Instance configuration source
Scheduled modeScheduledBasic + Scaling rule + Scheduled task
Dynamic modeDynamicBasic + Scaling rule + Event-triggered task
Custom modeCustomManual operations on the scaling group
Multi-modeCombinationAny combination of the above methods

Configuration method details:

  • Basic: Create a scaling group, attach an instance configuration source, and enable both. Auto Scaling can only scale instances after both the scaling group and the instance configuration source are active. This is the foundation for all other modes.

  • Scheduled: Build on the basic method by creating a scaling rule and a scheduled task. The scheduled task triggers the scaling rule at the configured time.

  • Dynamic: Build on the basic method by creating a scaling rule and an event-triggered task. The event-triggered task monitors a CloudMonitor metric and triggers the scaling rule when the alert condition is met.

Workflows

Auto Scaling supports three core workflows. Scale-out and scale-in work together — configure both to ensure your application can respond to traffic increases and decreases.

Figure 1: Scale-out workflow

弹性扩张示意图

Figure 2: Scale-in workflow

弹性收缩示意图

Figure 3: Elastic recovery workflow

弹性自愈示意图

Next steps