All Products
Search
Document Center

Auto Scaling:Configure scaling rules

Last Updated:Jan 13, 2025

The type of a scaling rule determines the purpose of the scaling rule. You can use a scaling rule to trigger scaling activities or automatically configure the boundary values for your scaling group. You can create scaling rules of different types based on your business requirements. For example, if you want to configure the boundary values for your scaling group, predictive scaling rules are a suitable option. This topic describes how to create, execute, modify, and delete scaling rules.

Background information

  • Auto Scaling supports the following types of scaling rules: simple scaling rules, step scaling rules, target tracking scaling rules, and predictive scaling rules. For more information, see Overview.

    • If your scaling group is of the Elastic Compute Service (ECS) type, you can create simple scaling rules, step scaling rules, target tracking scaling rules, and predictive scaling rules.

    • If your scaling group is of the Elastic Container Instance type, you can create simple scaling rules and target tracking scaling rules.

  • A scaling group supports a limited number of scaling rules. To view the quota of scaling rules, visit Quota Center.

Create scaling rules

  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 a region.

  4. Find the scaling group for which you want to create a scaling rule and click Details in the Actions column.

  5. In the upper part of the page that appears, click the Scaling Rules and Event-triggered Tasks tab.

  6. On the Scaling Rules tab, click Create Scaling Rule.

  7. In the Create Scaling Rule dialog box, configure parameters as required.

    1. Enter a name in the Rule Name text box.

    2. Specify a rule type and configure relevant parameters as required.

      The following tables describe the parameters of each type of scaling rule.

      Simple scaling rule

      You can create simple scaling rules for scaling groups of the ECS type and scaling groups of the Elastic Container Instance type.

      Parameter

      Description

      Operation

      The operation that is performed when the scaling rule is executed. Valid values:

      • Change to N Instances: When the scaling rule is executed, the number of instances in the scaling group is changed to N. A scaling group can have up to 1,000 instances added or removed in each operation.

      • Add N Instances: When the scaling rule is executed, N instances are added to the scaling group. A scaling group can have up to 1,000 instances added in each operation.

      • Add N%: When the scaling rule is executed, N% of the existing instances in the scaling group are added. A scaling group can have up to 1,000 instances added or removed in each operation.

      • Remove N Instances: When the scaling rule is executed, N instances are removed from the scaling group. A scaling group can have up to 1,000 instances removed in each operation.

      • Remove N%: When the scaling rule is executed, N% of the existing instances in the scaling group are removed. A scaling group can have up to 1,000 instances added or removed in each operation.

        Note

        If you set the Operation parameter to Add N% or Remove N%, you must also configure the Minimum Number of Instances to Adjust parameter.

      Cooldown Time

      The cooldown period of the scaling rule. Unit: seconds. This parameter is optional. If this parameter is not specified, the cooldown period of the scaling group is used. For more information, see Cooldown period.

      Step scaling rule

      You can create step scaling rules for only scaling groups of the ECS type.

      Parameter

      Description

      Monitoring Type

      The type of metric that you want to monitor. Valid values:

      • System Monitoring: the system metrics that are provided by CloudMonitor. If you set the Monitoring Type parameter to System Monitoring, you can specify a system event-triggered task for the scaling rule.

      • Custom Monitoring: the custom metrics that are reported to CloudMonitor. If you set the Monitoring Type parameter to Custom Monitoring, you can specify a custom event-triggered task for the scaling rule.

      Start Time

      The point at which the scaling rule is triggered by an event-triggered task. The conditions of the event-triggered task serve as the basis for step scaling.

      For example, you can configure a step scaling rule to trigger when the average CPU utilization reaches or exceeds 80% for three consecutive intervals.

      If no event-triggered task is available, you can create an event-triggered task for the step scaling rule. To create an event-triggered task for a step scaling rule, click Create Event-triggered Task to the right of the Start Time text box. For more information, see Manage event-triggered tasks.

      Note

      If an event-triggered task is created with a step scaling rule, the scaling group associated with the rule is the monitored resource, and the step scaling rule acts as the trigger rule for the task.

      Operation

      The step adjustment and alert breach of each scaling step. After the event-triggered task is triggered, Auto Scaling performs the specified operation to scale instances in steps. You must specify at least one step adjustment.

      Example:

      • Adds two ECS instances when the average CPU utilization is greater than or equal to 80% but less than 90%.

      • Adds three ECS instances when the average CPU utilization is greater than or equal to 90%.

      You must configure the alert breach size for each scaling step based on the trigger condition of the event-triggered task. For example, if the event-triggered task is triggered when the average CPU utilization exceeds or equals 80% for three consecutive intervals, set the lower limit of the alert breach size for the initial scaling step to 80% or higher.

      Step scaling rules support the same operations as simple scaling rules, including changing to N instances, adding N instances, removing N instances, adding N% of the existing instances, and removing N% of the existing instances.

      Note

      If you set the Operation parameter to Add N% or Remove N%, you must also configure the Minimum Number of Instances to Adjust parameter.

      Instance Warmup Time

      The duration during which instances remain in the Warmup state (measured in seconds). During this time, Auto Scaling adds instances to the scaling group but does not report their monitoring data to CloudMonitor. When calculating the required number of instances, Auto Scaling excludes instances in the Warmup state from the total count to prevent fluctuations in metric values until the warmup period ends.

      For example, if you set the Instance Warmup Time parameter of a step scaling rule to 300 seconds, Auto Scaling will not include the average CPU utilization of the two newly created instances in the calculation of the average CPU utilization for the scaling group during the 300-second warmup period.

      Target tracking scaling rule

      You can create target tracking scaling rules for scaling groups of the ECS type and scaling groups of the Elastic Container Instance type.

      Parameter

      Description

      Metric Type

      The type of the metric that you want to monitor. Select a CloudMonitor metric based on the type of your scaling group.

      • If your scaling group is of the ECS type, the following metrics are supported:

        • (ECS) Average CPU Utilization. Unit: %.

        • (ECS) Average Inbound Internal Traffic Unit: KB/min.

        • (ECS) Average Outbound Internal Traffic. Unit: KB/min.

        • (ECS) Average Inbound Public Traffic. Unit: KB/min.

        • (ECS) Average Outbound Public Traffic. Unit: KB/min.

        • (ALB) QPS per Backend Server. Unit: counts/s.

      • If your scaling group is of the Elastic Container Instance type, the following metrics are supported:

        • CPU Utilization. Unit: %.

        • Memory. Unit: %.

        • (ALB) QPS per Backend Server. Unit: queries/s.

      Note

      If you set the Metric Type parameter to (ALB) QPS per Backend Server, you must also configure the ALB Server Group parameter.

      Target Value

      The target value of the metric. Auto Scaling keeps the value of the monitored metric close to the target value.

      Instance Warmup Time

      The duration during which instances remain in the Warmup state (measured in seconds). During this time, Auto Scaling adds instances to the scaling group but does not report their monitoring data to CloudMonitor. When calculating the required number of instances, Auto Scaling excludes instances in the Warmup state from the total count to prevent fluctuations in metric values until the warmup period ends.

      Threshold for Scale-out Alerts

      The number of consecutive times the alert condition must be met before a scale-out event is triggered. After a target tracking scaling rule is created, an event-triggered task is automatically created and associated with the target tracking scaling rule.

      Threshold for Scale-in Alerts

      The number of consecutive times the alert condition must be met before a scale-in event is triggered. After a target tracking scaling rule is created, an event-triggered task is automatically created and associated with the target tracking scaling rule.

      Disable Scale-in

      Specifies whether to disable scale-ins. This feature affects the number of automatically created event-triggered tasks.

      • If you enable the Disable Scale-in feature, Auto Scaling creates only one event-triggered task for scale-out events to associate with the target tracking scaling rule.

      • If you disable the Disable Scale-in feature, Auto Scaling creates one event-triggered task for scale-out events and one event-triggered task for scale-ins to associate with the target tracking scaling rule.

      Predictive scaling rule

      You can create predictive scaling rules for only scaling groups of the ECS type. You can create only one predictive scaling rule for each scaling group.

      Parameter

      Description

      Reference Existing Target Tracking Scaling Rule

      Specifies whether to reference an existing target tracking scaling rule. This parameter is optional. If a target tracking scaling rule exists in the scaling group, the predictive scaling rule can inherit the values of the Metric Type and Target Value parameters that are specified for the target tracking scaling rule.

      Select a rule

      This parameter is available only after you enable the Reference Existing Target Tracking Scaling Rule feature. You can select an existing target tracking scaling rule to automatically fill the Metric Type and Target Value fields of the predictive scaling rule. This parameter is optional.

      Metric Type

      The type of the metric. Valid values:

      • (ECS) Average CPU Utilization. Unit: %.

      • (ECS) Average Inbound Internal Traffic Unit: KB/min.

      • (ECS) Average Outbound Internal Traffic. Unit: KB/min.

      Target Value

      The target value of the metric. When the predictive scaling rule is executed, Auto Scaling calculates the number of instances to scale based on this target value and other factors.

      Modifying the Target Value parameter causes Auto Scaling to delete the existing prediction task and create a new one within one hour.

      Predictive Mode

      The mode in which the predictive scaling rule works. Valid values:

      • Predict Only: produces predictions but does not create prediction tasks.

      • Predict and Scale: produces predictions and creates prediction tasks.

      We recommend that you select Predict Only and then change the value to Predict and Scale after you confirm that the predictions can meet your business requirements. On the details page of the predictive scaling rule, you can check whether the predictions meet your business requirements. For more information, see View the prediction of a predictive scaling rule.

      Preset Max Capacity

      The maximum number of instances allowed in the scaling group. This parameter is used together with the Maximum Capacity Handling Method parameter.

      If you leave this parameter empty, the current maximum number of instances specified for the scaling group is used.

      Maximum Capacity Handling Method

      Specifies whether to use the predicted value or the preset maximum capacity if the predicted value exceeds the preset maximum capacity. Valid values:

      • Predicted Capacity Overwrites Preset Max Capacity: uses the predicted value if the predicted value exceeds the preset maximum capacity.

      • Preset Max Capacity Overwrites Predicted Capacity: uses the preset maximum capacity if the predicted value exceeds the preset maximum capacity.

      • Predicted Capacity with Additional Ratio: uses the predicted value that is increased by a specific ratio. If you select this value, you must configure the Increase Ratio parameter.

      Default value: Predicted Capacity Overwrites Preset Max Capacity.

      Increase Ratio

      The ratio of the increase in the predicted value. This parameter is available only if you set the Maximum Capacity Handling Method parameter to Predicted Capacity with Additional Ratio. The predicted value that increases by this ratio is used the next time the prediction task runs. For example, if the predicted value is 100 and you set the Increase Ratio parameter to 10%, the predicted value that is used the next time the prediction task runs is 110.

      Valid values: 0 to 100. Default value: 0. Unit: %.

      Pre-launch Time

      The period of time during which the prediction task that is created by the predictive scaling rule is pre-launched. By default, the prediction task is executed on the hour. You can configure the Pre-launch Time parameter to pre-launch the prediction task and prepare resources in advance.

      Unit: minutes. Default value: 0. Maximum value: 60.

  8. Click OK.

    After you create a scaling rule, the scaling rule appears on the Scaling Rules tab. You can click the ID of the scaling rule to view information, such as the rule type, unique identifier, execution time, and scaling operation of the scaling rule.

Execute scaling rules

Precautions

  • You can execute scaling rules to manually or automatically adjust the number of ECS instances or elastic container instances. Simple scaling and step scaling rules must be executed manually. Auto Scaling can only execute target tracking and predictive scaling rules.

  • Before you execute a scaling rule, take note of the following items:

    • You have no overdue payments within your Alibaba Cloud account. If you have overdue payments, the execution will fail. To use Auto Scaling as expected, make sure that your Alibaba Cloud account has sufficient balance.

    • The scaling group to which the scaling rule that you want to execute belongs must be in the Enabled state.

    • If the Expected Number of Instances feature is enabled for the scaling group, the scaling group must have no ongoing scaling activities when you execute the scaling rule. If the Expected Number of Instances feature is disabled for the scaling group, the scaling group must have no ongoing non-parallel scaling activities when you execute the scaling rule. For more information, see Expected number of instances.

Procedure

The following section describes the methods to execute scaling rules in different scenarios.

  • Manual execution: If you want to adjust the number of ECS instances or elastic container instances out of schedule, you can manually execute scaling rules. If your scaling group has no ongoing scaling activities, you can ignore the specified cooldown period and immediately execute a scaling rule. Within the specified cooldown period, Auto Scaling rejects scaling requests initiated by CloudMonitor event-triggered tasks.

  • Automatic execution: If your business has specific patterns, you can configure scheduled tasks to automatically execute scaling rules. If your business does not have specific patterns, you can configure event-triggered tasks to automatically execute scaling rules.

Manual execution

  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 a region.

  4. Find the scaling group whose scaling rule you want to execute and click Details in the Actions column.

  5. In the upper part of the page that appears, click the Scaling Rules and Event-triggered Tasks tab.

  6. On the Scaling Rules tab, find the scaling rule that you want to execute and click Execute in the Actions column.

  7. In the Execute Scaling Rule message, click OK.

Automatic execution

Execution method

Description

Configure a scheduled task to execute a scaling rule

When you create a scheduled task, specify a scaling rule in the task. Auto Scaling automatically executes the scaling rule at the specified point in time. For more information about how to create a scheduled task, see Configure a scheduled task.

Configure an event-triggered task to execute a scaling rule

When you create an event-triggered task, specify a scaling rule in the task. Auto Scaling automatically executes the scaling rule when the alert condition of the task is met. For more information about how to create an event-triggered task, see Manage event-triggered tasks.

Note

For more information about the Event-triggered Task feature, see Overview.

Modify or delete scaling rules

Note
  • If a scaling rule no longer meets your business requirements, you can modify its parameter settings without creating a new rule.

  • If a scaling rule is no longer needed, you can delete the scaling rule to free up the scaling rule quota.

  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 a region.

  4. Find the scaling group whose scaling rule you want to modify or delete and click Details in the Actions column.

  5. In the upper part of the page that appears, click the Scaling Rules and Event-triggered Tasks tab.

  6. On the Scaling Rules tab, modify or delete the scaling rule.

    Modify scaling rules

    1. Find the scaling rule that you want to modify and click Edit in the Actions column.

    2. In the Edit Scaling Rule dialog box, modify parameter settings based on your business requirements and click OK.

      For information about the specific parameters, see Create scaling rules.

      Note

      You cannot modify the setting of the Rule Type parameter for any type of scaling rules. You cannot modify the setting of the Start Time parameter for step scaling rules.

    Delete scaling rules

    1. Find the scaling rule that you want to delete and click Delete in the Actions column.

    2. In the Delete Scaling Rule message, click OK.