A scaling rule defines specific scaling actions, for example, adding or removing n ECS instances.
If the execution of a scaling rule results in a number of ECS instances in the scaling group that is less than the MinSize or greater than the MaxSize, Auto Scaling automatically adjusts the number of ECS instances to be added or removed by executing the “Adjust scaling group instance quantity to MinSize” or “Adjust scaling group instance quantity to MaxSize” rule.
- Example 1: If a scaling group has a MaxSize of 3, the current number of instances (Total Capacity) is 2, and a scaling rule instructs the system to “add 3 ECS instances”, this operation actually only adds one ECS instance. (The values in the scaling rule are not changed.)
- Example 2: If a scaling group has a MinSize of 2, the current number of instances (Total Capacity) is 3, and a scaling rule instructs the system to “remove 5 ECS instances”, this operation actually only removes one ECS instance. (The values in the scaling rule are not changed.)
This operation creates a scaling rule according to input parameters.
When AdjustmentType is TotalCapaciy, the quantity of ECS instances in the current scaling group is adjusted to the specified value, and the corresponding AdjustmentValue must be no less than 0.
When AdjustmentType is QuantityChangeInCapacity or PercentChangeInCapacity, if the corresponding AdjustmentValue is a positive number, additional ECS instances are increased; if the corresponding AdjustmentValue is a negative number, ECS instances are decreased.
When AdjustmentType is PercentChangeInCapacity, the Auto Scaling service uses the formula: current number of instances (Total Capacity) * AdjustmentValue/100 and follow standard rounding principles to confirm the number of ECS instances to be added or removed.
When a cool-down time (Cooldown) is specified in a scaling rule, the specified Cooldown is applied to the scaling group after the scaling activity to perform this rule is completed. Otherwise, the DefaultCooldown is applied to the scaling group.
A maximum of 50 scaling rules can be created in a scaling group.
The only identifier of a scaling rule returned (ScalingRuleAri) can be primarily used by the following interfaces:
- By specifying the ExecuteScalingRule’s ScalingRuleAri parameter, you can manually perform a scaling rule.
- By specifying the CreateScheduledTask’s ScheduledAction parameter, you can schedule the performing of a scaling rule.
|Action||String||Yes||Operation interface, required. The parameter value is CreateScalingRule.|
|ScalingGroupId||String||Yes||ID of the scaling group of a scaling rule.|
|AdjustmentType||String||Yes||Adjustment mode of a scaling rule. Optional values:
- QuantityChangeInCapacity: It is used to increase or decrease a specified number of ECS instances.
- PercentChangeInCapacity: It is used to increase or decrease a specified proportion of ECS instances.
- TotalCapacity: It is used to adjust the quantity of ECS instances in the current scaling group to a specified value.
|AdjustmentValue||Integer||Yes||Adjusted value of a scaling rule. Value range:
- QuantityChangeInCapacity: (0, 100] U (-100, 0]
- PercentChangeInCapacity: [0, 10000] U [-10000, 0]
- TotalCapacity: [0, 100]
|ScalingRuleName||String||No||Name shown for the scaling group, which is a string containing 2 to 40 English or Chinese characters. It must begin with a number, a letter (case-insensitive) or a Chinese character and can contain numbers, “_”, “-“ or “.”. The account name in the same scaling group is unique in the same region. If this parameter value is not specified, the default value is ScalingRuleId.|
|Cooldown||Integer||No||Cool-down time of a scaling rule. Value range: [0, 86,400], in seconds. The default value is empty.|
|ScalingRuleId||String||ID of a scaling rule, generated by the system and globally unique.|
|ScalingRuleAri||String||Unique identifier of a scaling rule.|
&<Public Request Parameters>
|Error code||Error message||HTTP status code||Description|
|InvalidScalingGroupId.NotFound||The specified scaling group does not exist.||404||The specified scaling group does not exist in this account.|
|InvalidScalingRuleName.Duplicate||The specified value of parameter
||400||The scaling rule name already exists.|
|QuotaExceeded.ScalingRule||Scaling rule quota exceeded in the specified scaling group.||400||Scaling rule quantity exceeds the upper limit for a user to use.|