If the existing scaling rule does not meet your requirements, you can use the ModifyScalingRule API to update its attributes. This process eliminates the need to create a new scaling rule, saving both time and resources.
Debugging
Request parameters
Name |
Type |
Required |
Example |
Description |
Action | String | Yes | ModifyScalingRule | Required parameter. Valid value: ModifyScalingRule. |
ScalingRuleId | String | Yes | asr-bp1dvirgwkoowxk7**** | The ID of the scaling rule to be modified. |
ScalingRuleName | String | No | scalingrule**** | The name of the scaling rule. It must be 2 to 64 characters in length, start with a digit, uppercase or lowercase letter, or Chinese character, and can contain digits, underscores (_), hyphens (-), or periods (.). Note The name of each scaling rule must be unique within the same account, region, and scaling group. |
Cooldown | Integer | No | 60 | The cooldown time of the scaling rule. This parameter is valid only when the ScalingRuleType parameter is set to SimpleScalingRule. Valid values: 0 to 86400. Unit: seconds. |
MinAdjustmentMagnitude | Integer | No | 1 | The minimum adjustment instance count for scaling rules is effective only when the scaling rule type is |
AdjustmentType | String | No | QuantityChangeInCapacity | The adjustment method of the scaling rule. This parameter is required only if you set ScalingRuleType to SimpleScalingRule or StepScalingRule. Valid values:
|
AdjustmentValue | Integer | No | 100 | The number of instances that must be scaled based on the scaling rule. This parameter is required only if you set ScalingRuleType to SimpleScalingRule or StepScalingRule. The number of ECS instances that can be added or removed in a single scaling operation cannot exceed 1,000. Valid values based on the AdjustmentType value:
|
EstimatedInstanceWarmup | Integer | No | 60 | The warmup period of instances to scale. This parameter is available only if you set ScalingRuleType to TargetTrackingScalingRule or StepScalingRule. ECS instances in the Warmup state are added to the scaling group but do not report monitoring data to CloudMonitor during the warmup period. Note When Auto Scaling calculates the number of ECS instances that must be scaled, ECS instances in the Warmup state are not counted toward the current capacity of the scaling group. Valid values: 0 to 86400. Unit: seconds. |
MetricName | String | No | CpuUtilization | The predefined metric. This parameter is required only if you create a target tracking scaling rule or predictive scaling rule. Valid values for target tracking scaling rules:
Valid values for predictive scaling rules:
For more information, see the referenced document. |
TargetValue | Float | No | 0.125 | The target value. This parameter is available only if you set ScalingRuleType to TargetTrackingScalingRule or PredictiveScalingRule. The value must be greater than 0 and can have up to three decimal places. |
DisableScaleIn | Boolean | No | true | Specifies whether to disable scale-in. This parameter is available only if you set ScalingRuleType to TargetTrackingScalingRule. |
ScaleInEvaluationCount | Integer | No | 15 | The number of consecutive times that the event-triggered task created for scale-in events must meet the threshold conditions before an alert is triggered. After you create a target tracking scaling rule, an event-triggered task is automatically created and associated with the target tracking scaling rule. |
ScaleOutEvaluationCount | Integer | No | 3 | The number of consecutive times that the event-triggered task created for scale-out events must meet the threshold conditions before an alert is triggered. After you create a target tracking scaling rule, an event-triggered task is automatically created and associated with the target tracking scaling rule. |
PredictiveScalingMode | String | No | PredictAndScale | The mode of the predictive scaling rule. Valid values:
|
PredictiveValueBehavior | String | No | MaxOverridePredictiveValue | The action on the predicted maximum value. Valid values:
|
PredictiveValueBuffer | Integer | No | 50 | The |
PredictiveTaskBufferTime | Integer | No | 30 | The amount of buffer time before the prediction task is executed. By default, all prediction tasks that are automatically created for a predictive scaling rule are executed on the hour. You can specify an amount of buffer time for resource preparation before the prediction tasks are executed. Valid values: 0 to 60. |
InitialMaxSize | Integer | No | 100 | The maximum number of ECS instances that can be contained in the scaling group. If you specify InitialMaxSize, you must specify PredictiveValueBehavior. |
StepAdjustment.N.MetricIntervalUpperBound | Float | No | 5.0 | The upper limit specified in a step adjustment. This parameter takes effect only if you set the ScalingRuleType parameter to StepScalingRule. Valid values: -9.999999E18 to 9.999999E18. |
StepAdjustment.N.ScalingAdjustment | Integer | No | 1 | The number of ECS instances that you want to scale in a step adjustment. This parameter is available only if you set the ScalingRuleType parameter to StepScalingRule. |
StepAdjustment.N.MetricIntervalLowerBound | Float | No | 1.0 | The lower limit specified in a step adjustment. This parameter takes effect only if you set the ScalingRuleType parameter to StepScalingRule. Valid values: -9.999999E18 to 9.999999E18. |
AlarmDimension.N.DimensionKey | String | No | rulePool | The key of dimension N that is associated with the metric. |
AlarmDimension.N.DimensionValue | String | No | sgp-l1cbirz451yxu2**** | The value of the dimension. |
MetricType | String | No | system | The type of the metric. Valid values:
|
HybridMonitorNamespace | String | No | aliyun-test | The ID of the Hybrid Cloud Monitoring metric. For more information, see the referenced document. |
HybridMetrics.N.Id | String | No | a | The reference ID of the metric in the metric expression. |
HybridMetrics.N.Expression | String | No | (a+b)/2 | The metric expression that consists of multiple Hybrid Cloud Monitoring metrics. It calculates a result used to trigger scaling events. The expression must comply with the Reverse Polish Notation (RPN) specification, and the operators only support |
HybridMetrics.N.MetricName | String | No | AliyunSmq_NumberOfMessagesVisible | The name of the Hybrid Cloud Monitoring metric. |
HybridMetrics.N.Statistic | String | No | Average | The statistical method of the metric value. Valid values:
|
HybridMetrics.N.Dimensions.N.DimensionKey | String | No | queue | The key of the metric dimension. |
HybridMetrics.N.Dimensions.N.DimensionValue | String | No | testQueue | The value of the metric dimension. |
Return data
Name |
Type |
Example |
Description |
RequestId | String | 473469C7-AA6F-4DC5-B3DB-A3DC0DE3**** | The request ID. |
Examples
Request Example
http(s)://ess.aliyuncs.com/?Action=ModifyScalingRule
&ScalingRuleId=asr-bp1dvirgwkoowxk7****
&ScalingRuleName=scalingrule****
&Cooldown=60
&MinAdjustmentMagnitude=1
&AdjustmentType=QuantityChangeInCapacity
&AdjustmentValue=100
&EstimatedInstanceWarmup=60
&MetricName=CpuUtilization
&TargetValue=0.125
&DisableScaleIn=true
&ScaleInEvaluationCount=15
&ScaleOutEvaluationCount=3
&PredictiveScalingMode=PredictAndScale
&PredictiveValueBehavior=MaxOverridePredictiveValue
&PredictiveValueBuffer=50
&PredictiveTaskBufferTime=30
&InitialMaxSize=100
&StepAdjustment=[{"MetricIntervalUpperBound":5.0,"ScalingAdjustment":1,"MetricIntervalLowerBound":1.0}]
&AlarmDimension=[{"DimensionKey":"rulePool","DimensionValue":"sgp-l1cbirz451yxu2****"}]
&MetricType=system
&HybridMonitorNamespace=aliyun-test
&HybridMetrics=[{"Id":"a","MetricName":"AliyunSmq_NumberOfMessagesVisible","Statistic":"Average","Dimensions":[{"DimensionKey":"queue","DimensionValue":"testQueue"}]}]
&公共请求参数
Sample Success Responses
XML
Format
HTTP/1.1 200 OK
Content-Type:application/xml
<ModifyScalingRuleResponse>
<RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3****</RequestId>
</ModifyScalingRuleResponse>
JSON
Format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****"
}
Error codes
For more error codes, visit the Error Center.
HttpCode |
Error code |
Error message |
Description |
404 |
InvalidScalingRuleId.NotFound |
The specified scaling rule does not exist. |
The specified scaling rule does not exist within the Alibaba Cloud account. |
400 |
InvalidScalingRuleName.Duplicate |
The specified value of parameter <parameter name> is duplicated. |
The name of the scaling rule already exists. |
400 |
QuotaExceeded.ScalingRule |
Scaling rule quota exceeded in the specified scaling group. |
The maximum number of scaling rules in the scaling group has been reached. |
400 |
TargetTrackingScalingRule.UnsupportedMetric |
Specific metric is not supported for target tracking scaling rule. |
The target tracking scaling rule does not support the specified metric. |
400 |
TargetTrackingScalingRule.DumplicateMetric |
Only one TargetTrackingScaling rule for a given metric specification is allowed. |
The metric is already specified for another target tracking scaling rule in the scaling group. |
400 |
InvalidMinAdjustmentMagnitudeMismatchAdjustmentType |
MinAdjustmentMagnitude is not supported by the specified adjustment type. |
MinAdjustmentMagnitude does not support the adjustment method of the scaling rule. |
400 |
InvalidStepAdjustments.MultipleNullUpperBound |
At most one StepAdjustment may have an unspecified upper bound. |
A step adjustment that does not have an upper limit already exists. |
400 |
InvalidStepAdjustments.MultipleNullLowerBound |
At most one StepAdjustment may have an unspecified lower bound. |
A step adjustment that does not have a lower limit already exists. |
400 |
InvalidStepAdjustments.NoNullLowerBound |
There must be a StepAdjustment with an unspecified lower bound when one StepAdjustment has a negative lower bound. |
The error message returned because the lower limit of a step adjustment is a negative value, but a different step adjustment without a lower limit does not exist. |
400 |
InvalidStepAdjustments.NoNullUpperBound |
There must be a StepAdjustment with an unspecified upper bound when one StepAdjustment has a positive upper bound. |
The error message returned because the upper limit of a step adjustment is a positive value, but a different step adjustment without an upper limit does not exist. |
400 |
InvalidStepAdjustments.Gap |
StepAdjustment intervals can not have gaps between them. |
The error message returned because the specified ranges of step adjustments have gaps. |
400 |
InvalidStepAdjustments.Overlap |
StepAdjustment intervals can not overlap. |
The error message returned because the specified ranges of step adjustments overlap. |
400 |
InvalidStepAdjustments.LowerGtUpper |
LowerBound must be less than the UpperBound for StepAdjustment :%s. |
The error message returned because the lower limit value of a step adjustment is greater than or equal to the upper limit. |
400 |
InvalidStepAdjustments.BothNull |
Both lower and upper bounds of a StepAdjustment can not be left unspecified. |
The error message returned because the upper limit value or the lower limit value for a step adjustment must be specified. |
400 |
InvalidStepAdjustments.MaxNum |
Your scaling rule can have at most %s StepAdjustments. |
The error message returned because the maximum number of step adjustments in a scaling group has been reached. |
400 |
StepBeyondPermitRange |
Specific parameter "%s" beyond permit range. |
The error message returned because the specified upper limit or lower limit for a step adjustment is invalid. |