All Products
Search
Document Center

Auto Scaling:Manage scaling rules

Last Updated:Mar 06, 2024

The type of a scaling rule determines the capability of the scaling rule. You can use a scaling rule to trigger scaling activities or automatically configure the boundary values of your scaling group. You can create scaling rules of different types based on your business requirements. For example, if you need to only configure the boundary values of your scaling group to meet your business requirements, you can create predictive scaling rules. 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.

  • You can create only a limited number of scaling rules for a scaling group. 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 the region where Auto Scaling is activated.

  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 field.

    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. Up to 1000 instances can be added to or removed from a scaling group in each operation.

      • Add N Instances: When the scaling rule is executed, N instances are added to the scaling group. Up to 1000 instances can be added to a scaling group in each operation.

      • Add N%: When the scaling rule is executed, N% of the existing instances in the scaling group are added. Up to 1000 instances can be added to a scaling group in each operation.

      • Remove N Instances: When the scaling rule is executed, N instances are removed from the scaling group. Up to 1000 instances can be removed from a scaling group in each operation.

      • Remove N%: When the scaling rule is executed, N% of the existing instances in the scaling group are removed. Up to 1000 instances can be removed from a scaling group 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 in time at which the scaling rule is triggered by an event-triggered task. The conditions to trigger the event-triggered tasks are used as the reference for step scaling.

      For example, you can select an event-triggered task that triggers the scaling rule when the average CPU utilization is greater than or equal to 80% for three consecutive times.

      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 you create an event-triggered task when you create a step scaling rule, the resource that is monitored by the event-triggered task is the scaling group for which you create the step scaling rule, and the trigger rule of the event-triggered task is the step scaling rule that you create.

      Operation

      The step adjustments and alert breaches of the step scaling rule. 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.

      Examples:

      • 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 size of the alert breach for each scaling step based on the trigger condition of the event-triggered task. For example, the event-triggered task is triggered when the average CPU utilization is greater than or equal to 80% for three consecutive times. In this case, the lower limit of the alert breach for the initial scaling adjustment must be greater than or equal to 80%.

      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 period of time during which instances are in the Warmup state. Unit: seconds. Auto Scaling adds instances in the Warmup state to a scaling group but does not report the monitoring data of the instances to CloudMonitor. When Auto Scaling calculates the number of instances to scale based on the monitoring data, Auto Scaling does not count instances in the Warmup state as part of the existing instances in the scaling group to prevent metric values from fluctuating until the warmup period ends.

      For example, you set the Instance Warmup Time parameter of a step scaling rule to 300 seconds. After Auto Scaling executes the step scaling rule to create two instances, the average CPU utilization of the two instances is not counted when Auto Scaling calculates the average CPU utilization of instances in the scaling group within 300 seconds.

      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 period of time during which instances are in the Warmup state. Unit: seconds. Auto Scaling adds instances in the Warmup state to a scaling group but does not report the monitoring data of the instances to CloudMonitor. When Auto Scaling calculates the number of instances to scale based on the monitoring data, Auto Scaling does not count instances in the Warmup state as part of the existing instances in the scaling group to prevent metric values from fluctuating until the warmup period ends.

      Threshold for Scale-out Alerts

      The number of consecutive times that the alert condition is met before a scale-out 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 that the alert condition is met before a scale-in 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-outs 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-outs 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 appropriate number of instances that can be scaled based on factors such as the target value.

      If you modify the value of the Target Value parameter, Auto Scaling deletes the existing prediction task and creates a new prediction task 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 that can be contained in the scaling group. This parameter is used together with the Maximum Capacity Handling Method parameter.

      If you do not configure this parameter, 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 is greater than the preset maximum capacity. Valid values:

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

      • Preset Max Capacity Overwrites Predicted Capacity: uses the preset maximum capacity if the predicted value is greater than 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

Usage notes

  • You can manually execute scaling rules to adjust the number of ECS instances or elastic container instances. You can also enable Auto Scaling to execute scaling rules. You must manually execute simple scaling rules and step scaling rules. Auto Scaling can execute target tracking scaling rules 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 scaling rule will fail to be executed. 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 the 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 use scheduled tasks to automatically execute scaling rules. If your business does not have specific patterns, you can use 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 the region where Auto Scaling is activated.

  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 message that appears, click OK.

Automatic execution

Execution method

Description

Execute a scaling rule by using a scheduled task

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 Create scheduled tasks.

Execute a scaling rule by using an event-triggered task

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 the parameter settings of the scaling rule without the need for 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 the region where Auto Scaling is activated.

  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 a scaling rule

    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 a scaling rule

    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.