All Products
Search
Document Center

Auto Scaling:Scaling policies

Last Updated:Dec 05, 2025

A scaling group automatically adjusts resources based on changes in application load to ensure service stability and cost-effectiveness. When a scale-out or scale-in operation is triggered, the system selects appropriate instances to add to or remove from the scaling group based on preset scaling policies. This topic describes the available scaling policies and how to configure them.

Scaling policy descriptions

By default, a scaling group performs scaling activities based on the order of the vSwitches that you configure. This default behavior is known as the Priority policy. You can change the Scaling Policy to use other policies. Auto Scaling provides several preset scaling policies that are described in this section.

Important

You can change this configuration only when the Scaling Group Type is set to ECS. If the Scaling Group Type is ECI, the Scaling Policy defaults to the Priority Policy.

  • Priority Policy (default policy)

    This policy scales instances out or in based on the order of the vSwitches that you define. If an instance cannot be created in the zone of a higher-priority vSwitch, the system automatically attempts to create the instance in the zone of the next-priority vSwitch.

  • Balanced Distribution Policy

    This policy distributes instances evenly across multiple zones to support multi-zone disaster recovery. If the number of ECS instances becomes unbalanced across zones for reasons such as insufficient inventory, you can perform a rebalancing operation to restore the balance. For more information, see Rebalance ECS instances.

  • Cost Optimization Policy

    Use the Cost Optimization Policy when cost is a high priority. When a scaling activity occurs, this policy attempts to create instances in ascending order of their vCPU unit price. If the scaling configuration includes multiple instance types that use the spot billing method, the policy attempts to create spot instances first. If the policy cannot create spot instances, for example, due to insufficient inventory, it automatically attempts to create pay-as-you-go instances. During a scale-in activity, the policy removes the instances with the highest vCPU unit price first.

  • Custom Combination Policy

    This policy lets you customize capacity distribution using a combination of settings. You can use this policy to adjust the ratio of on-demand instances to spot instances, balance capacity across zones, and select instance types in the scaling group.

For configuration instructions, see Configure a scaling policy.

Configure a scaling policy

Change the scaling policy of an existing scaling group

To change the Scaling Policy for an existing scaling group, follow these steps.

  1. Log on to the Auto Scaling console.

  2. In the left-side navigation pane, click Scaling Groups.

  3. In the top navigation bar, select the region where Auto Scaling is activated.

  4. On the Scaling Group Management page, find the scaling group for which you want to change the Scaling Policy. In the Actions column, click the Modify button to open the Modify Scaling Group window.

  5. Set Scaling Policy to the desired policy.

    If you select the Balanced Distribution Policy, Cost Optimization Policy, or Custom Combination Policy, you must configure the related child configuration items. For more information about the child configuration items, see Child configuration items.

  6. Click the OK button to complete the configuration.

Configure a scaling policy when creating a scaling group

You can also configure the Scaling Policy on the creation page when you create a scaling group, as shown in the following figure.

image

If you select the Cost Optimization Policy or Custom Combination Policy, you must configure the related child configuration items. For more information about the child configuration items, see Child configuration items.

Child configuration items

If you set the Balanced Distribution Policy, Cost Optimization Policy, or Custom Combination Policy, you must configure additional child configuration items as described in the following tables.

Balanced distribution policy

Configuration Item

Description

Balance Mode

  • Best-effort Delivery: The default delivery mode. If an instance fails to be created in a zone due to resource limitations, the system falls back to another zone.

  • Balanced Only: If an instance fails to be created in a zone due to resource limitations, the system does not fall back to another zone.

Enable Auto-rebalance

If you enable this feature, the scaling group automatically detects zone capacity. If the capacity is unbalanced across zones, the group proactively scales out or in between zones to rebalance the capacity.

Cost optimization policy

Configuration Item

Description

Minimum Pay-as-you-go Instances

The minimum number of pay-as-you-go ECS instances that the scaling group must contain. The default value is 0. If the number of pay-as-you-go ECS instances in the scaling group is less than this value, pay-as-you-go instances are created first during a scale-out.

Percentage of Pay-as-you-go Instances

The percentage of pay-as-you-go instances among the automatically created ECS instances. The default value is 70%. This calculation excludes the number of instances specified by Minimum Number Of On-demand Instances In The Group (units).

Lowest Cost Instance Types

The number of lowest-priced instance types to use for creating instances. The default value is 1. This parameter takes effect only when multiple instance types are specified in the scaling configuration. When creating spot instances, the scaling group distributes the instances evenly across the specified number of lowest-priced instance types.

Enable Supplemental Spot Instances

If you enable this feature, the scaling group creates a new spot instance to replace a spot instance that is scheduled to be reclaimed. The replacement instance is created approximately 5 minutes before the reclamation.

Use Pay-as-you-go Instances to Supplement Spot Capacity

This feature is enabled by default. If the required spot instance capacity cannot be met for reasons such as price or inventory, the scaling group attempts to create pay-as-you-go instances to meet the capacity requirement.

Replace Pay-as-you-go Instance with Spot Instance

After you enable Use Pay-as-you-go Instances to Supplement Spot Capacity, the percentage of on-demand instances in the scaling group may exceed the value specified for Percentage of Pay-as-you-go Instances. If you enable this option, the scaling group attempts to replace the excess on-demand instances with spot instances.

Custom combination policy

Configuration Item

Description

Minimum Pay-as-you-go Instances

The minimum number of pay-as-you-go ECS instances that the scaling group must contain. The default value is 0. If the number of pay-as-you-go ECS instances in the scaling group is less than this value, pay-as-you-go instances are created first during a scale-out.

Percentage of Pay-as-you-go Instances

The percentage of pay-as-you-go instances among the automatically created ECS instances. The default value is 70%. This calculation excludes the number of instances specified by Minimum Number Of On-demand Instances In The Group (units).

Multi-zone Balanced Distribution

Distributes ECS instances evenly across the zones that are specified for the scaling group. To use multiple zones, you must specify multiple vSwitches.

Note

You can perform a rebalancing operation to balance the distribution of ECS instances across zones. For more information, see Rebalance ECS instances.

Capacity Planning Policy

Specifies how the scaling group selects from available instance types to meet capacity requirements.

  • Instance Type Configuration Order: Creates instances in the order of the configured instance types.

  • Lowest Price: Creates instances in ascending order of the unit vCPU price of the instance types.

Configure Spot Capacity Planning Policy

If you enable this option, you can specify a separate capacity distribution policy for spot instances.

Spot Capacity Planning Policy

Same as Capacity Planning Policy.

Lowest Cost Instance Types

The number of lowest-priced instance types to use. When creating spot instances, the system distributes them evenly across the specified number of instance types.

Enable Supplemental Spot Instances

If you enable this feature, the system creates a new spot instance to replace an existing spot instance approximately 5 minutes before it is reclaimed.

Use Pay-as-you-go Instances to Supplement Spot Capacity

This feature is enabled by default. If the required spot instance capacity cannot be met for reasons such as price or inventory, the scaling group attempts to create pay-as-you-go instances to meet the capacity requirement.

Replace Pay-as-you-go Instance with Spot Instance

After you enable Use Pay-as-you-go Instances to Supplement Spot Capacity, the percentage of on-demand instances in the scaling group may exceed the value specified for Percentage of Pay-as-you-go Instances. If you enable this option, the scaling group attempts to replace the excess on-demand instances with spot instances.

Change a scaling group's scaling policy using an API

You can call an API operation to change the scaling policy of a scaling group. This section uses the ModifyScalingGroup operation as an example. The required configuration items vary based on the scaling policy, as described in the following sections.

Set the Priority policy

This policy scales instances out or in based on the order of the vSwitches that you define. If an instance cannot be created in the zone of a higher-priority vSwitch, the system automatically attempts to create the instance in the zone of the next-priority vSwitch.

Parameter

Type

Description

How to set

ScalingGroupId

string

The ID of the scaling group. (Required)

Set this to the ID of the scaling group you want to modify.

MultiAZPolicy

string

The scaling policy. (Required)

To implement the Priority Policy, set this to PRIORITY.

Set the Balanced Distribution policy

Important

To create instances in multiple zones, the scaling group must be configured with vSwitches in multiple zones.

Parameter

Type

Description

How to set

ScalingGroupId

string

The ID of the scaling group. (Required)

Set this to the ID of the scaling group you want to modify.

MultiAZPolicy

string

The scaling policy. (Required)

To implement the Balanced Distribution Policy, set this to BALANCE.

BalanceMode

string

The balance mode. (Optional)

Valid values:

  • BalancedBestEffort: Best-effort Delivery. If an instance fails to be created in a zone, the system falls back to another zone to ensure best-effort resource delivery.

  • BalancedOnly: If an instance fails to be created in a zone due to resource limitations, the system does not fall back to another zone.

Default value: BalancedBestEffort

AutoRebalance

boolean

Enable automatic balancing. (Optional)

If you enable this feature, the scaling group automatically detects zone capacity. If the capacity is unbalanced across zones, the group proactively scales out or in between zones to rebalance the capacity.

This parameter takes effect only when BalanceMode=BalancedOnly.

Valid values:

  • false: Do not enable.

  • true: Enable.

Default value: false.

If the instance distribution becomes unbalanced across zones for reasons such as insufficient inventory, you can manually call the relevant API operation to rebalance the instances. For more information, see RebalanceInstances - Rebalance the distribution of ECS instances.

Set the Cost Optimization policy

This policy attempts to create instances in ascending order of vCPU unit price. If the scaling configuration is set up for spot instances, spot instances are created first. If spot instances cannot be created, the system attempts to create on-demand instances.

Important

The Cost Optimization policy takes effect only if you specify multiple instance types or enable spot instances in the scaling configuration.

Parameter

Type

Description

How to set

ScalingGroupId

string

The ID of the scaling group. (Required)

Set this to the ID of the scaling group you want to modify.

MultiAZPolicy

string

The scaling policy. (Required)

To implement the Cost Optimization Policy, set this to COST_OPTIMIZED.

OnDemandBaseCapacity

integer

The minimum number of on-demand instances in the group (units). (Optional)

When the number of on-demand instances in the scaling group is less than this value, the system creates on-demand instances first.

Set as needed.

Range: 0 to 1000.

Default value: 0.

OnDemandPercentageAboveBaseCapacity

integer

The percentage of on-demand instances (%). (Optional)

The percentage of on-demand instances among the instances that exceed the OnDemandBaseCapacity.

Set as needed.

Range: 0 to 100.

Default value: 0.

SpotInstancePools

integer

The number of lowest-cost instance types (count).

The number of instance types with the lowest prices. This takes effect when multiple optional instance types are specified in the scaling configuration.
When creating spot instances, the scaling group creates ECS instances in a balanced manner among the lowest-priced instance types.

Set as needed.

Range: 0 to 10.

Default value: 2.

SpotInstanceRemedy

boolean

Whether to enable spot instance compensation.

After you enable spot instance compensation, the scaling group proactively creates a new spot instance to replace a spot instance that is about to be reclaimed 5 minutes before the reclamation.

Set as needed.

Valid values:

  • true: Enable.

  • false: Disable.

CompensateWithOnDemand

boolean

Whether to enable Use on-demand instances to supplement spot capacity.

If sufficient spot instances cannot be created due to reasons such as price or inventory, this specifies whether to allow the system to automatically try to create on-demand instances to meet the required number of ECS instances.

Set as needed.

Valid values:

  • true: Enable.

  • false: Disable.

CapacityOptions.SpotAutoReplaceOnDemand

boolean

Whether to enable automatic replacement of on-demand instances with spot instances.

When CompensateWithOnDemand is enabled, if the percentage of on-demand instances exceeds the OnDemandPercentageAboveBaseCapacity, the system tries to replace on-demand capacity with spot capacity.

Set as needed.

Valid values:

  • true: Enable.

  • false: Disable.

Set the Custom Combination policy

You can use this policy to adjust the ratio of on-demand instances to spot instances in the scaling group, balance capacity across zones, and select instance types.

Parameter

Type

Description

How to set

ScalingGroupId

string

The ID of the scaling group. (Required)

Set this to the ID of the scaling group you want to modify.

MultiAZPolicy

string

The scaling policy. (Required)

To implement the Custom Combination Policy, set this to COMPOSABLE.

OnDemandBaseCapacity

integer

The minimum number of on-demand instances in the group (units). (Optional)

When the number of on-demand instances in the scaling group is less than this value, the system creates on-demand instances first.

Set as needed.

Range: 0 to 1000.

Default value: 0.

OnDemandPercentageAboveBaseCapacity

integer

The percentage of on-demand instances (%). (Optional)

The percentage of on-demand instances among the instances that exceed the OnDemandBaseCapacity.

Set as needed.

Range: 0 to 100.

Default value: 100.

AzBalance

boolean

Whether to enable zone capacity balancing. (Optional)

Evenly distributes ECS instances across the multiple zones specified for the scaling group (that is, multiple VPC vSwitches are specified). If instances become unbalanced across zones due to reasons such as insufficient inventory, you can call the relevant API to rebalance them. For more information, see RebalanceInstances - Rebalance the distribution of ECS instances.

Set as needed.

Valid values:

  • true: Enable.

  • false: Disable.

AllocationStrategy

string

Capacity distribution policy. (Optional)

The capacity distribution policy determines how the scaling group selects available instance types to meet capacity requirements.

Set as needed.

Valid values:

  • priority (default value): Creates instances in the order of the configured instance types.

  • lowestPrice: Creates instances in ascending order of the unit vCPU price of the instance types.

SpotAllocationStrategy

string

Specify a separate spot capacity distribution policy. (Optional)

Use this option to specify a separate capacity distribution policy for spot instances.

Set as needed.

Valid values:

  • priority: Creates instances in the order of the configured instance types.

  • lowestPrice: Creates instances in ascending order of the unit vCPU price of the instance types.

SpotInstancePools

integer

Number of lowest-cost instance types (count).

Important

This field must be set when the AllocationStrategy or SpotAllocationStrategy parameter is set to lowestPrice.

The number of instance types with the lowest prices. This takes effect when multiple optional instance types are specified in the scaling configuration.
When creating spot instances, the scaling group creates ECS instances in a balanced manner among the lowest-priced instance types.

Set as needed.

Range: 0 to 10.

Default value: 2.

SpotInstanceRemedy

boolean

Whether to enable spot instance compensation.

Important

This field must be set when the AllocationStrategy or SpotAllocationStrategy parameter is set to lowestPrice.

After you enable spot instance compensation, the scaling group proactively creates a new spot instance to replace a spot instance that is about to be reclaimed 5 minutes before the reclamation.

Set as needed.

Valid values:

  • true: Enable.

  • false: Disable.

CompensateWithOnDemand

boolean

Whether to enable Use on-demand instances to supplement spot capacity.

Important

This field must be set when the AllocationStrategy or SpotAllocationStrategy parameter is set to lowestPrice.

If sufficient spot instances cannot be created due to reasons such as price or inventory, this specifies whether to allow the system to automatically try to create on-demand instances to meet the required number of ECS instances.

Set as needed.

Valid values:

  • true: Enable.

  • false: Disable.

CapacityOptions.SpotAutoReplaceOnDemand

boolean

Whether to enable automatic replacement of on-demand instances with spot instances.

When CompensateWithOnDemand is enabled, if the percentage of on-demand instances exceeds the OnDemandPercentageAboveBaseCapacity, the system tries to replace on-demand capacity with spot capacity.

Set as needed.

Valid values:

  • true: Enable.

  • false: Disable.