Depending on its type, a scaling rule either triggers a scaling activity or manages the capacity of a scaling group. For example, if you only need to manage the capacity boundaries for your scaling group, we recommend using a predictive scaling rule. This topic describes creating, executing, modifying, and deleting 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.
For scaling groups of the Elastic Compute Service (ECS) type, you can create simple scaling rules, step scaling rules, target tracking scaling rules, and predictive scaling rules.
For scaling groups of the Elastic Container Instance (ECI) type, you can create simple scaling rules and target tracking scaling rules.
The number of scaling rules per scaling group is limited. To view the quota of scaling rules, visit Quota Center.
Create a scaling rule
Log on to the Auto Scaling console.
In the left-side navigation pane, click Scaling Groups.
In the top navigation bar, select a region.
Find the scaling group that you want to manage and click Details in the Actions column.
In the upper part of the page that appears, click the Scaling Rules and Tasks tab.
On the Scaling Rules tab, click Create Scaling Rule.
Configure the parameters for the scaling rule.
Enter a Rule Name.
Select a rule type and configure its parameters.
The following tables describe the parameters for each type of scaling rules.
Simple scaling rule
You can configure these parameters for scaling groups of both ECS and ECI instances.
Parameter
Description
Operation
The operation that is performed when the scaling rule is executed. Valid values:
Change to N Instances: Changes the total number of instances in the scaling group to N. You can trigger a scaling activity for up to 1,000 instances.
Add N Instances: Adds N instances to the current number of instances in the scaling group. You can add a maximum of 1,000 instances.
Add N%: Increases the number of instances in the scaling group by N% based on the current number of instances. You can trigger a scaling activity for up to 1,000 instances.
Remove N Instances: Removes N instances from the current number of instances in the scaling group. You can remove a maximum of 1,000 instances.
Remove N%: Decreases the number of instances in the scaling group by N% based on the current number of instances. You can trigger a scaling activity for up to 1,000 instances.
NoteWhen selecting Add N% or Remove N%, you must also set the Minimum Number of Instances to Adjust.
Cooldown Time
Optional. The unit is seconds. If you leave this parameter empty, Auto Scaling uses the cooldown time of the scaling group. For more information, see Cooldown period.
Step scaling rule
You can configure these parameters only for scaling groups of ECS instances.
Parameter
Description
Monitoring Type
Select the monitoring type based on the event-triggered task you want to associate:
System Monitoring: Refers to metrics collected by CloudMonitor. If you select this option, you can specify a system monitoring task.
Custom Monitoring: Refers to custom metrics you report to CloudMonitor. If you select this option, you can specify a custom monitoring task.
Start Time
Specify an event-triggered task. The step adjustments are based on the task's trigger conditions.
For example, Average CPU Utilization is greater than or equal to 80% for 3 consecutive periods.
If no Event-triggered Tasks are available, you can create one by clicking Create Event-triggered Task to the right of the Start Time text box. For more information, see Manage event-triggered tasks.
NoteIf you create an Event-triggered Task while creating a Step Scaling Rule, Auto Scaling (ESS) automatically sets the Monitoring resource for the task to the current scaling group and the Alert trigger rule to the current Step Scaling Rule.
Operation
Configure step adjustments based on the trigger conditions of the Event-triggered Task. Specify the magnitude of the metric breach and the corresponding action. After the task triggers, Auto Scaling scales the group based on the specified breach size. You must specify at least one step adjustment.
Example:
When 80 <= Average CPU Utilization < 90, add 2 instances.
When 90 <= Average CPU Utilization < +∞, add 3 instances.
The CloudMonitor metric limits the breach size you set for each step adjustment. For example, if the CloudMonitor metric is "Average CPU Utilization is greater than or equal to 80% for 3 consecutive periods", the step adjustments must start from >= 80%.
Step Scaling Rules support the same operations as Simple Scaling Rules: Change to N Instances, Add N Instances, Remove N Instances, Add N%, and Remove N%.
NoteWhen selecting Add N% or Remove N%, you must also set the Minimum Number of Instances to Adjust.
Instance Warmup Time
The unit is seconds. Auto Scaling adds instances in a warmup state to the scaling group, but these instances do not report monitoring data to CloudMonitor. When dynamically calculating the number of instances to add or remove, Auto Scaling does not count instances in a warmup state as part of the current instance total. This prevents metric fluctuations.
For example, if the Instance Warmup Time for a Step Scaling Rule is 300 seconds and 2 instances are added, the metrics of these 2 instances are not included in the calculation of the average CPU utilization for the scaling group for 300 seconds after they are created.
Target tracking scaling rule
You can configure these parameters for scaling groups of both ECS and ECI instances.
Parameter
Description
Metric Type
Select a CloudMonitor metric based on the type of your scaling group.
If the scaling group is for ECS instances, you can select one of the following metrics:
(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 the scaling group is for ECI instances, you can select one of the following metrics:
CPU Utilization. Unit: %.
Memory. Unit: %.
(ALB) QPS per Backend Server. Unit: queries/s.
NoteWhen selecting the (ALB) QPS per Backend Server metric, you must also set the ALB Server Group.
Target Value
The target value for the selected CloudMonitor metric. The Target Tracking Scaling Rule maintains the metric value at or near this target value.
Instance Warmup Time
The unit is seconds. Auto Scaling adds instances in a warmup state to the scaling group, but these instances do not report monitoring data to CloudMonitor. When dynamically calculating the number of instances to add or remove, Auto Scaling does not count instances in a warmup state as part of the current instance total. This prevents metric fluctuation.
Threshold for Scale-out Alerts
When you create a target tracking scaling rule, Auto Scaling automatically creates event-triggered tasks. This parameter specifies the number of consecutive periods the threshold must be met to trigger the automatically created scale-out task.
Threshold for Scale-in Alerts
When you create a target tracking scaling tule, Auto Scaling automatically creates event-triggered tasks. This parameter specifies the number of consecutive periods the threshold must be met to trigger the automatically created scale-in task.
Disable Scale-in
This setting determines how many Event-triggered Tasks are automatically created.
If you disable scale-in, the target tracking scaling rule creates only one event-triggered task for scale-out activities. As a result, Auto Scaling does not remove any ECS or ECI instances from the scaling group.
If you allow scale-in, the target tracking scaling rule creates two event-triggered tasks: one for scaling out and one for scaling in.
Predictive scaling rule
You can configure these parameters only for scaling groups of ECS instances. You can create only one predictive scaling rule per scaling group.
Parameter
Description
Reference Existing Target Tracking Scaling Rule
Optional. Specifies whether to use an existing Target Tracking Scaling Rule. If you have an existing rule, you can reuse its Metric Type and Target Value.
Select a rule
Optional. This parameter appears only if you enable Reference Existing Target Tracking Scaling Rule. You can then select a Target Tracking Scaling Rule to automatically use its Metric Type and Target Value.
Metric Type
The type of the metric. Valid values:
(ECS) Average CPU Utilization. Unit: %.
(ECS) Average Inbound Internal Traffic Unit: Kbit/min.
(ECS) Average Outbound Internal Traffic. Unit: Kbit/min.
Target Value
The target value for the selected CloudMonitor metric. The Predictive Scaling Rule uses the target value and other factors to calculate the appropriate number of instances.
If you modify the target value, the scaling group clears all existing prediction tasks and creates new ones within an hour.
Predictive Mode
The mode in which the predictive scaling rule works. Valid values:
Predict Only: Generates prediction data but does not create scheduled scaling tasks.
Predict and Scale: Generates prediction data and creates scheduled scaling tasks.
We recommend that you first select Predict Only. If the prediction results meet your expectations, you can then change the mode to Predict and Scale. You can view the prediction results on the scaling rule details page. For more information, see View the prediction of a predictive scaling rule.
Preset Max Capacity
The upper limit on the number of instances in the scaling group. This parameter works in conjunction with Maximum Capacity Handling Method.
The default value is the scaling group's current maximum number of instances.
Maximum Capacity Handling Method
Specifies how to handle the predicted capacity when it exceeds the preset maximum capacity:
Predicted Capacity Overwrites Preset Max Capacity: If the predicted capacity is greater than the preset maximum, the scheduled scaling task uses the predicted capacity as the new maximum.
Preset Max Capacity Overwrites Predicted Capacity: If the predicted capacity is greater than the preset maximum, the scheduled scaling task uses the preset maximum capacity.
Predicted Capacity with Additional Ratio: Used with Increase Ratio.
Default value: Predicted Capacity Overwrites Preset Max Capacity.
Increase Ratio
This parameter appears only if you set Maximum Capacity Handling Method to Predicted Capacity with Additional Ratio. Auto Scaling increases the current predicted capacity by this ratio to determine the new predicted capacity. For example, if the current predicted capacity is 100 and the increase ratio is 10%, the scheduled scaling task sets the maximum number of instances to 110.
The default value is 0%, and the maximum value is 100%.
Pre-launch Time
By default, scheduled scaling tasks created by a predictive scaling rule run on the hour. To execute the tasks earlier and prepare resources in advance, you can set a pre-launch time.
Unit: minutes. Default value: 0. Maximum value: 60.
Click OK.
After you create the scaling rule, you can find it in the scaling rule list. Click the scaling rule ID to view details such as the rule type, rule identifier, execution time, and operation.
Execute scaling rules
Precautions
You must execute simple scaling and step scaling rules manually, whereas Auto Scaling executes target tracking and predictive scaling rules automatically.
Before executing a scaling rule, note the following:
Your account must be in good standing; overdue payments will cause all scaling activities to fail. To ensure normal operation, make sure your account has a sufficient balance.
The scaling group to which the scaling rule belongs must be in the Enabled state.
If the Expected Number of Instances feature is disabled for the scaling group, no scaling activities can be in progress. If the Expected Number of Instances feature is enabled, no non-parallel scaling activities can be in progress. 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 need to temporarily adjust your ECS or ECI resources, you can manually execute a scaling rule. When no scaling activities are in progress within the scaling group, a manually triggered scaling activity can execute immediately without waiting for the cooldown time to elapse. During the cooldown time, the scaling group only rejects scaling activity requests triggered by CloudMonitor event-triggered tasks.
Automatic execution: If your business load follows a predictable pattern, you can use a scheduled task to execute a scaling rule. If your business load does not follow a clear pattern, you can use an event-triggered task based on monitoring metrics to execute the scaling rule.
Manual execution
Log on to the Auto Scaling console.
In the left-side navigation pane, click Scaling Groups.
In the top navigation bar, select a region.
Find the scaling group that you want to manage and click Details in the Actions column.
In the upper part of the page that appears, click the Scaling Rules and Tasks tab.
In the Scaling Rules list, find the rule you want to execute and click Execute in the Actions column.
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. Auto Scaling executes this rule at the specified 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. Auto Scaling executes this rule when the monitored metrics meet the alert conditions. For more information about how to create an event-triggered task, see Manage event-triggered tasks. Note For more information about event-triggered tasks, see Overview of event-triggered tasks. |
Modify or delete a scaling rule
If a scaling rule no longer meets your needs, you can modify it instead of creating a new one.
To free up your quota, delete scaling rules you no longer need.
Log on to the Auto Scaling console.
In the left-side navigation pane, click Scaling Groups.
In the top navigation bar, select a region.
Find the scaling group that you want to manage and click Details in the Actions column.
In the upper part of the page that appears, click the Scaling Rules and Tasks tab.
In the Scaling Rules list, modify or delete the scaling rule.
Modify a scaling rule
Find the scaling rule that you want to modify and click Edit in the Actions column.
Modify the parameters as needed, and then click OK.
For detailed parameter descriptions, see Create a scaling rule.
NoteYou cannot change the Rule Type for any scaling rule. For step scaling rules, you cannot change the Start Time.
Delete a scaling rule
Find the rule you want to delete and click Delete in the Actions column.
In the confirmation dialog box that appears, click OK.