All Products
Search
Document Center

Auto Scaling:ModifyScalingRule

更新时间:May 07, 2025

Modifies a scaling rule. If an existing scaling rule does not meet your business requirements, you can call the ModifyScalingRule operation to modify the scaling rule, without the need to create a new one. This operation streamlines your tasks by eliminating the need for repetitive actions, thereby significantly decreasing the time required and minimizing resource expenditures.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter

Type

Required

Example

Description

Action

String

Yes

ModifyScalingRule

The operation that you want to perform. Set the value to ModifyScalingRule.

ScalingRuleId

String

Yes

asr-bp1dvirgwkoowxk7****

The ID of the scaling rule that you want to modify.

ScalingRuleName

String

No

scalingrule****

The name of the scaling rule. The name must be 2 to 64 characters in length, and can contain letters, digits, underscores (_), hyphens (-), and periods (.). The name must start with a letter or a digit.

Note

The name of each scaling rule must be unique within the same account and region.

Cooldown

Integer

No

60

The cooldown period of the scaling rule. This parameter is available only if you set ScalingRuleType to SimpleScalingRule.

Valid values: 0 to 86400. Unit: seconds.

MinAdjustmentMagnitude

Integer

No

1

The minimum number of instances that must be scaled. This parameter takes effect if you set ScalingRuleType to SimpleScalingRule or StepScalingRule, and AdjustmentType to PercentChangeInCapacity.

AdjustmentType

String

No

QuantityChangeInCapacity

The adjustment method used by the scaling rule. If you set ScalingRuleType to SimpleScalingRule or StepScalingRule, you must specify this parameter. Valid values:

  • QuantityChangeInCapacity: adds a specific number of (Elastic Compute Service) ECS instances to or removes a specific number of ECS instances from the scaling group.

  • PercentChangeInCapacity: adds a specific percentage of ECS instances to or removes a specific percentage of ECS instances from the scaling group.

  • TotalCapacity: adjusts the number of ECS instances in the scaling group to a specified number.

AdjustmentValue

Integer

No

100

The number of instances that can be added to or removed from the scaling group based on the scaling rule. If you set ScalingRuleType to SimpleScalingRule or StepScalingRule, you must specify this parameter. The maximum number of ECS instances that can be added or removed in a single scaling operation is 1,000 regardless of the scenario. The value range of this parameter varies based on the value of AdjustmentType.

  • Valid values if you set AdjustmentType to QuantityChangeInCapacity: -1000 to 1000.

  • Valid values if you set AdjustmentType to PercentChangeInCapacity: -100 to 10000.

  • Valid values if you set AdjustmentType to TotalCapacity: 0 to 2000.

EstimatedInstanceWarmup

Integer

No

60

The warmup period of instances that can be added to or removed from the scaling group. You can specify this parameter only for simple scaling rules and step scaling rules. Auto Scaling adds ECS instances in the Warmup state to the scaling group but does not send monitoring data to CloudMonitor during the warmup period.

Note

ECS instances in the Warmup state are excluded from the capacity calculation when Auto Scaling determines the number of instances to scale.

Valid values: 0 to 86400. Unit: seconds.

MetricName

String

No

CpuUtilization

The predefined metric of the scaling rule. If you set ScalingRuleType to TargetTrackingScalingRule or PredictiveScalingRule, you must also specify this parameter.

Valid values if you set ScalingRuleType to TargetTrackingScalingRule:

  • CpuUtilizationAgent (recommended): the CPU utilization.

  • MemoryUtilization (recommended): the memory usage.

  • CpuUtilization: the average CPU utilization.

  • IntranetTx: the outbound traffic over an internal network.

  • IntranetRx: the average inbound traffic over an internal network.

  • VpcInternetTx: the outbound traffic from a virtual private cloud (VPC) to the Internet.

  • VpcInternetRx: the inbound traffic from the Internet to a VPC.

  • LoadBalancerRealServerAverageQps: the queries per second (QPS) per Application Load Balancer (ALB) server group.

Valid values if you set ScalingRuleType to PredictiveScalingRule:

  • CpuUtilization: the average CPU utilization.

  • IntranetRx: the average inbound traffic over an internal network.

  • IntranetTx: the average outbound traffic over an internal network.

For more information, see Event-triggered tasks of the system monitoring type.

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 a maximum of three decimal places.

DisableScaleIn

Boolean

No

true

Specifies whether to disable scale-in. This parameter is available if you set ScalingRuleType to TargetTrackingScalingRule.

ScaleInEvaluationCount

Integer

No

15

After you create a target tracking scaling rule, an event-triggered task is automatically created and associated with the scaling rule. This parameter defines the number of consecutive times the alert condition must be satisfied before the event-triggered task initiates a scale-in operation.

ScaleOutEvaluationCount

Integer

No

3

After you create a target tracking scaling rule, an event-triggered task is automatically created and associated with the scaling rule. This parameter defines the number of consecutive times the alert condition must be satisfied before the event-triggered task initiates a scale-out operation.

PredictiveScalingMode

String

No

PredictAndScale

The mode of the predictive scaling rule. Valid values:

  • PredictAndScale: provides predictions and creates prediction tasks.

  • PredictOnly: provides predictions but does not create prediction tasks.

PredictiveValueBehavior

String

No

MaxOverridePredictiveValue

The action that you want to take on the predicted maximum value. Valid values:

  • MaxOverridePredictiveValue: uses the initial maximum capacity as the maximum value for prediction tasks if the predicted value is greater than the initial maximum capacity.

  • PredictiveValueOverrideMax: uses the predicted value as the maximum value for prediction tasks if the predicted value is greater than the initial maximum capacity.

  • PredictiveValueOverrideMaxWithBuffer: increases the predicted value by a ratio that is specified by PredictiveValueBuffer, and uses the increased value as the maximum value for prediction tasks if the predicted value increased by the ratio is greater than the initial maximum capacity.

PredictiveValueBuffer

Integer

No

50

The ratio based on which the predicted value is increased if you set PredictiveValueBehavior to PredictiveValueOverrideMaxWithBuffer. If the predicted value increased by this ratio is greater than the initial maximum capacity, the increased value is used as the maximum value for prediction tasks. Valid values: 0 to 100.

PredictiveTaskBufferTime

Integer

No

30

The amount of buffer time before prediction tasks are run. By default, all prediction tasks that are automatically created based on a predictive scaling rule are run on the hour. You can specify a buffer time for resource preparation before prediction tasks are run. Valid values: 0 to 60.

InitialMaxSize

Integer

No

100

The maximum number of ECS instances that can be added to the scaling group. If you specify InitialMaxSize, you must also specify PredictiveValueBehavior.

StepAdjustment.N.MetricIntervalUpperBound

Float

No

5.0

The upper limit of a step adjustment. This parameter takes effect only if you set ScalingRuleType 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 each step adjustment. This parameter is available only if you set ScalingRuleType to StepScalingRule.

StepAdjustment.N.MetricIntervalLowerBound

Float

No

1.0

The lower limit in a step adjustment. This parameter is available only if you set ScalingRuleType to StepScalingRule. Valid values: -9.999999E18 to 9.999999E18.

AlarmDimension.N.DimensionKey

String

No

rulePool

The dimension key of the metric.

AlarmDimension.N.DimensionValue

String

No

sgp-l1cbirz451yxu2****

The dimension value of the metric.

MetricType

String

No

system

The type of the metric used by the event-triggered task. Valid values:

  • system: system metrics of CloudMonitor.

  • custom: custom metrics that are reported to CloudMonitor.

  • hybrid: metrics of Hybrid Cloud Monitoring.

HybridMonitorNamespace

String

No

aliyun-test

The ID of the Hybrid Cloud Monitoring namespace.

For information about how to manage Hybrid Cloud Monitoring namespaces, see Manage namespaces.

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 be written in Reverse Polish Notation (RPN) format and supports only the following operators: +, -, *, /.

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:

  • Average: calculates the average value of all metric values within a specified interval.

  • Minimum: calculates the minimum value of all metric values within a specified interval.

  • Maximum: calculates the maximum value of all metric values within a specified interval.

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.

AlarmOptions.Period

Integer

No

60

The statistical period of the metric data in the target tracking scaling rule. Unit: seconds. Valid values:

  • 15

  • 60

  • 120

  • 300

  • 900

Note

Default value: 60.

Response parameters

Parameter

Type

Example

Description

RequestId

String

473469C7-AA6F-4DC5-B3DB-A3DC0DE3****

The request ID.

Examples

Sample requests

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"}]}]
&<Common request parameters>

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 a list of error codes, see Service error codes.

HTTP status code

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.

A step adjustment has a negative lower limit, but no step adjustment without a lower limit exists.

400

InvalidStepAdjustments.NoNullUpperBound

There must be a StepAdjustment with an unspecified upper bound when one StepAdjustment has a positive upper bound.

A step adjustment has a positive upper limit, but no step adjustment without an upper limit exists.

400

InvalidStepAdjustments.Gap

StepAdjustment intervals can not have gaps between them.

The step adjustments have gaps.

400

InvalidStepAdjustments.Overlap

StepAdjustment intervals can not overlap.

The ranges of step adjustments overlap.

400

InvalidStepAdjustments.LowerGtUpper

LowerBound must be less than the UpperBound for StepAdjustment :%s.

The lower limit 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.

You cannot specify an upper limit and a lower limit for a step adjustment at the same time.

400

InvalidStepAdjustments.MaxNum

Your scaling rule can have at most %s StepAdjustments.

The maximum number of step adjustments in a scaling group has been reached.

400

StepBeyondPermitRange

Specific parameter "%s" beyond permit range.

The specified upper limit or lower limit for a step adjustment is invalid.