CreateScalingRule
Creates a scaling rule.
Operation description
API Description
Note the following about the related parameters:
When AdjustmentType is TotalCapacity, it adjusts the number of ECS or ECI instances in the current scaling group to the specified number. The corresponding AdjustmentValue must be greater than or equal to 0.
When AdjustmentType is QuantityChangeInCapacity or PercentChangeInCapacity, a positive AdjustmentValue indicates adding instances and a negative value indicates removing instances.
When AdjustmentType is PercentChangeInCapacity, Auto Scaling calculates the number of ECS or ECI instances to add or remove using the formula: current instance count (Total Capacity) x AdjustmentValue / 100, with rounding applied.
When a cooldown period (Cooldown) is specified in the scaling rule, the scaling group will be cooled down for the specified period after the scaling activity triggered by this rule is completed. If no cooldown period is specified in the scaling rule, the cooldown period specified for the scaling group (DefaultCooldown) is used.
The number of scaling rules that can be created in a scaling group is limited. For more information, see Limits.
- The returned unique identifier of the scaling rule (ScalingRuleAri) can be used in the following APIs:
Specified in the ScalingRuleAri parameter of ExecuteScalingRule to manually execute the scaling rule.
Specified in the ScheduledAction parameter of CreateScheduledTask to execute the scaling rule on a schedule.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
ess:CreateScalingRule |
create |
*ScalingGroup
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| ScalingGroupId |
string |
Yes |
The ID of the scaling group to which the scaling rule belongs. |
asg-bp1ffogfdauy0jw0**** |
| ScalingRuleName |
string |
No |
The name of the scaling rule. The name must be 2 to 64 characters in length and start with a digit, letter, or Chinese character. It can contain digits, underscores (_), hyphens (-), or periods (.). The scaling rule name must be unique within a scaling group under the same user account in the same region. Note
If this parameter is not specified, the default value is the value of ScalingRuleId. |
scalingrule**** |
| Cooldown |
integer |
No |
The cooldown period of the scaling rule. This parameter is applicable only to simple scaling rules. Valid values: 0 to 86400. Unit: seconds. Default value: empty. |
60 |
| MinAdjustmentMagnitude |
integer |
No |
The minimum number of instances to adjust in a scaling rule. This parameter takes effect only when the scaling rule type is |
1 |
| AdjustmentType |
string |
No |
The adjustment method of the scaling rule. This parameter is applicable to simple scaling rules and step scaling rules, and is required in these cases. Valid values:
|
QuantityChangeInCapacity |
| AdjustmentValue |
integer |
No |
The adjustment value of the scaling rule. This parameter is applicable to simple scaling rules and step scaling rules, and is required in these cases. The number of ECS instances adjusted in a single scaling activity cannot exceed 1,000. Valid values for different adjustment methods:
|
100 |
| ScalingRuleType |
string |
No |
The type of the scaling rule. Valid values:
Default value: SimpleScalingRule. |
SimpleScalingRule |
| EstimatedInstanceWarmup |
integer |
No |
The warm-up period of instances. This parameter is applicable to target tracking scaling rules and step scaling rules. ECS instances in the warm-up state are added to the scaling group as normal but do not report monitoring data to CloudMonitor during the warm-up period. Note
When dynamically calculating the number of ECS instances to scale, instances in the warm-up state are not counted as part of the existing instance count. Valid values: 0 to 86400. Unit: seconds. Default value: 300. |
300 |
| MetricName |
string |
No |
The predefined metric. This parameter is applicable to target tracking scaling rules and predictive scaling rules, and is required in these cases. Valid values for target tracking scaling rules:
Valid values for predictive scaling rules:
For more information, see System monitoring alert tasks. |
CpuUtilization |
| TargetValue |
number |
No |
The target value. This parameter is applicable to target tracking scaling rules and predictive scaling rules, and is required in these cases. The TargetValue can have up to three decimal places and must be greater than 0. |
0.125 |
| DisableScaleIn |
boolean |
No |
Specifies whether to disable scale-in. This parameter is applicable only to target tracking scaling rules. Default value: false. |
false |
| ScaleInEvaluationCount |
integer |
No |
After a target tracking scaling rule is created, an alert task is automatically created. This parameter specifies the number of consecutive times that the threshold condition must be met before the corresponding scale-in alert task triggers an alert. Default value: 15. |
15 |
| ScaleOutEvaluationCount |
integer |
No |
After a target tracking scaling rule is created, an alert task is automatically created. This parameter specifies the number of consecutive times that the threshold condition must be met before the corresponding scale-out alert task triggers an alert. Default value: 3. |
3 |
| PredictiveScalingMode |
string |
No |
The mode of the predictive scaling rule. Valid values:
Default value: PredictAndScale. |
PredictAndScale |
| PredictiveValueBehavior |
string |
No |
The method used to process the maximum value for the predictive scaling rule. Valid values:
Default value: MaxOverridePredictiveValue. |
MaxOverridePredictiveValue |
| PredictiveValueBuffer |
integer |
No |
This parameter takes effect only when Default value: 0. |
50 |
| PredictiveTaskBufferTime |
integer |
No |
Prediction tasks automatically created by a predictive scaling rule are executed at the start of each hour by default. You can set a pre-launch time to execute prediction tasks in advance to prepare resources ahead of time. Valid values: 0 to 60. Unit: minutes. Default value: 0. |
30 |
| InitialMaxSize |
integer |
No |
The maximum number of instances in the scaling group. This parameter is used in combination with PredictiveValueBehavior. Default value: the maximum number of instances in the scaling group (the value of MaxSize). |
100 |
| StepAdjustment |
array<object> |
No |
The collection of instance scaling information corresponding to step adjustments. |
|
|
object |
No |
The collection of instance scaling information corresponding to step adjustments. |
||
| MetricIntervalUpperBound |
number |
No |
The upper boundary of a step adjustment. This parameter is applicable only to step scaling rules. Valid values: -9.999999E18 to 9.999999E18. |
5.0 |
| ScalingAdjustment |
integer |
No |
The number of instances to scale corresponding to a step adjustment. This parameter is applicable only to step scaling rules. |
1 |
| MetricIntervalLowerBound |
number |
No |
The lower boundary of a step adjustment. This parameter is applicable only to step scaling rules. Valid values: -9.999999E18 to 9.999999E18. |
1.0 |
| RegionId |
string |
No |
The region ID of the scaling group. |
cn-hangzhou |
| AlarmDimension |
array<object> |
No |
The dimension information associated with the metric. This parameter is applicable to target tracking scaling rules. Set this parameter when the metric requires additional dimension information. For example, the |
|
|
object |
No |
The dimension information associated with the metric. This parameter is applicable to target tracking scaling rules. Set this parameter when the metric requires additional dimension information. For example, the |
||
| DimensionKey |
string |
No |
The key of the dimension associated with the metric. |
rulePool |
| DimensionValue |
string |
No |
The value of the dimension associated with the metric. |
sgp-l1cbirz451yxu2**** |
| MetricType |
string |
No |
The type of the metric. Valid values:
|
system |
| HybridMonitorNamespace |
string |
No |
The ID of the Hybrid Cloud Monitoring metric namespace. To manage metric namespaces, see Manage metric namespaces. |
aliyun-test |
| HybridMetrics |
array<object> |
No |
The Hybrid Cloud Monitoring metric settings. For information about how to configure them, see Use formula-based custom target tracking rules. |
|
|
array<object> |
No |
|||
| Id |
string |
No |
The reference ID of the metric in the metric expression. |
a |
| Expression |
string |
No |
The metric expression for multiple Hybrid Cloud Monitoring metrics. The calculation result of the expression is used to trigger scaling. The expression must conform to the Reverse Polish Notation (RPN) specification, and only the operators |
(a+b)/2 |
| MetricName |
string |
No |
The metric name in the Hybrid Cloud Monitoring metric namespace. |
AliyunSmq_NumberOfMessagesVisible |
| Statistic |
string |
No |
The statistical method of the metric. Valid values:
|
Average |
| Dimensions |
array<object> |
No |
The metric dimensions. Used to specify the resources monitored by the metric. |
|
|
object |
No |
|||
| DimensionKey |
string |
No |
The key of the metric dimension. |
queue |
| DimensionValue |
string |
No |
The value of the metric dimension. |
testQueue |
| AlarmOptions |
object |
No |
The alert attribute definitions. |
|
| Period |
integer |
No |
The period for collecting metric data in the target tracking scaling rule. Unit: seconds. Valid values: Note
Default value: 60. |
60 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| ScalingRuleAri |
string |
The unique identifier of the scaling rule. |
ari:acs:ess:cn-hangzhou:140692647406****:scalingrule/asr-bp1dvirgwkoowxk7**** |
| RequestId |
string |
The request ID. |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3**** |
| ScalingRuleId |
string |
The ID of the scaling rule, which is generated by the system and is globally unique. |
asr-bp1dvirgwkoowxk7**** |
Examples
Success response
JSON format
{
"ScalingRuleAri": "ari:acs:ess:cn-hangzhou:140692647406****:scalingrule/asr-bp1dvirgwkoowxk7****",
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****",
"ScalingRuleId": "asr-bp1dvirgwkoowxk7****"
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.