All Products
Search
Document Center

Auto Scaling:Scaling policies

Last Updated:Sep 24, 2024

Auto Scaling automatically scales resources to respond to workload changes. This ensures service stability and cost-effectiveness. During scaling events, Auto Scaling needs to select appropriate instances to add or remove based on the preset scaling policies. This topic describes the scaling policies supported by Auto Scaling.

Introduction to scaling policies

By default, Auto Scaling triggers scaling events in a scaling group based on the specified order (priority policy) of vSwitches. You can set the Scaling Policy parameter to other policies based on your business requirements.

Important

You can configure the Scaling Policy parameter only for scaling groups whose Type parameter is set to ECS and Network Type parameter is set to VPC. If your scaling group is of the ECI type, only the priority policy is supported.

  • Priority policy (default)

    This policy adds or removes Elastic Compute Service (ECS) instances based on the specified vSwitches. If Auto Scaling cannot create ECS instances in the zone where the vSwitch with the highest priority resides, Auto Scaling creates ECS instances in the zone where the vSwitch with the next highest priority resides.

  • Balanced distribution policy

    This policy ensures disaster recovery. If you want to evenly distribute ECS instances across the zones of your scaling group after scaling events are complete, use this policy. If ECS instances are not evenly distributed across multiple zones due to insufficient resources, execute the balanced distribution policy to evenly redistribute instances across the zones. For more information, see Rebalance the distribution of ECS instances.

  • Cost optimization policy

    If you prioritize cost in your decision-making, use this policy. When a scale-out event occurs, Auto Scaling preferentially creates ECS instances by using the instance type that has the lowest-priced vCPU. If multiple preemptible instance types are specified in your scaling configuration, Auto Scaling preferentially creates preemptible instances. If Auto Scaling fails to create preemptible instances due to insufficient resources, Auto Scaling attempts to create pay-as-you-go instances. When a scale-in event occurs, Auto Scaling preferentially removes ECS instances of the instance type that has the highest-priced vCPU from your scaling group.

  • Custom combination policy

    If you use this policy, you can adjust the ratio of pay-as-you-go instances to preemptible instances, balance instance distribution across zones, and specify instance types.

For information about the custom combination policy, see Configure a scaling policy.

Configure a scaling policy

Modify an existing scaling policy

To modify an existing scaling policy for a scaling group, perform the following 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 Groups page, find the scaling group whose scaling policy you want to modify. In the Actions column, click Edit to open the Edit Scaling Group dialog box.

  5. Specify the desired policy for the Scaling Policy parameter.

    If you set the Scaling Policy parameter to Cost Optimization Policy or Custom Combination Policy, you must configure policy attributes. For more information, see Policy attributes.

  6. Click OK.

Create a scaling policy

When you create a scaling group on the Create by Form tab, you must configure the Scaling Policy parameter, as shown in the following figure.

image

If you set the Scaling Policy parameter to Cost Optimization Policy or Custom Combination Policy, you must configure policy attributes. For more information, see Policy attributes.

Policy attributes

The following table describes the attributes of cost optimization and custom combination policies.

Cost optimization policy

Parameter

Description

Minimum Pay-as-you-go Instances

The minimum number of pay-as-you-go ECS instances. Default value: 0. If the number of pay-as-you-go ECS instances in the scaling group is less than the value of this parameter, Auto Scaling preferentially creates pay-as-you-go ECS instances.

Percentage of Pay-as-you-go Instances

The percentage of pay-as-you-go ECS instances among all automatically created ECS instances. Default value: 70%. When you calculate the percentage, do not include the minimum number of pay-as-you-go ECS instances that is specified by the Minimum Pay-as-you-go Instances parameter.

Lowest Cost Instance Types

The number of instance types that have the lowest cost. Default value: 1. This parameter takes effect only if you specify multiple instance types in the scaling configuration. Auto Scaling evenly creates preemptible ECS instances of the lowest-priced instance types.

Enable Supplemental Preemptible Instances

After you enable this feature, Auto Scaling automatically creates preemptible ECS instances 5 minutes before the existing ECS instances are reclaimed.

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

By default, this feature is enabled. If preemptible instances cannot be created due to factors such as cost-related issues and insufficient resources, Auto Scaling creates pay-as-you-go ECS instances to meet the required number of preemptible instances.

Custom combination policy

Parameter

Description

Minimum Pay-as-you-go Instances

The minimum number of pay-as-you-go ECS instances. Default value: 0. If the number of pay-as-you-go ECS instances in the scaling group is less than the value of this parameter, Auto Scaling preferentially creates pay-as-you-go ECS instances.

Percentage of Pay-as-you-go Instances

The percentage of pay-as-you-go ECS instances among all automatically created ECS instances. Default value: 70 %. When you calculate the percentage, do not include the minimum number of pay-as-you-go ECS instances that is specified by the Minimum Pay-as-you-go Instances parameter.

Multi-zone Balanced Distribution

This policy ensures that ECS instances are evenly distributed among the zones (vSwitches) of the scaling group.

Note

You can rebalance the distribution of ECS instances across multiple zones. For more information, see Rebalance the distribution of ECS instances.

Capacity Planning Policy

The capacity planning policy specifies how Auto Scaling selects instance types to create instances based on the capacity requirement.

  • Instance Type Configuration Order: Auto Scaling creates ECS instances based on the specified order of instance types.

  • Lowest Price: Auto Scaling preferentially creates ECS instances of the instance type that has the lowest unit price of vCPUs.

Configure Preemptible Capacity Planning Policy

After you enable this feature, you can specify a capacity planning policy for preemptible instances.

Preemptible Capacity Planning Policy

The capacity planning policy specifies how Auto Scaling selects instance types to create preemptible instances based on the capacity requirement.