Modifies a scaling rule.

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

ParameterTypeRequiredExampleDescription
ActionStringYesModifyScalingRule

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

ScalingRuleIdStringYesasr-bp1dvirgwkoowxk7****

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

ScalingRuleNameStringNoscalingrule****

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. The name of a scaling rule must be unique within an Alibaba Cloud account in a region.

CooldownIntegerNo60

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.

MinAdjustmentMagnitudeIntegerNo1

The minimum number of instances that must be scaled. This parameter takes effect only when ScalingRuleType is set to SimpleScalingRule or StepScalingRule and AdjustmentType is set to PercentChangeInCapacity.

AdjustmentTypeStringNoQuantityChangeInCapacity

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

  • QuantityChangeInCapacity: adds the specified number of Elastic Compute Service (ECS) instances to or removes the specified number of ECS instances from the scaling group.
  • PercentChangeInCapacity: adds the specified percentage of ECS instances to or removes the specified percentage of ECS instances from the scaling group.
  • TotalCapacity: adjusts the number of ECS instances in the scaling group to a specified number.
AdjustmentValueIntegerNo100

The number of instances that must be scaled based on the scaling rule. If you set ScalingRuleType to SimpleScalingRule or StepScalingRule, you must specify this parameter. The number of ECS instances to be scaled in a single scaling activity cannot exceed 1,000. Valid values of AdjustmentValue vary based on the value of AdjustmentType.

  • Valid values of AdjustmentValue when AdjustmentType is set to QuantityChangeInCapacity: -1000 to 1000.
  • Valid values of AdjustmentValue when AdjustmentType is set to PercentChangeInCapacity: -100 to 10000.
  • Valid values of AdjustmentValue when AdjustmentType is set to TotalCapacity: 0 to 2000.
EstimatedInstanceWarmupIntegerNo60

The warmup period of an ECS instance. This parameter is available only if you set ScalingRuleType to TargetTrackingScalingRule or PredictiveScalingRule. Auto Scaling adds ECS instances that are in the Warmup state to a scaling group but does not report monitoring data of the ECS instances to CloudMonitor during the warmup period.

Note When Auto Scaling calculates the number of ECS instances that you want to scale, the ECS instances that are in the Warmup state are not counted towards the current capacity of the scaling group.

Valid values: 0 to 86400. Unit: seconds.

MetricNameStringNoCpuUtilization

The predefined metric that you want to monitor. If you set ScalingRuleType to TargetTrackingScalingRule or PredictiveScalingRule, you must specify this parameter.

Valid values of MetricName when ScalingRuleType is set to TargetTrackingScalingRule:

  • CpuUtilization: the average CPU utilization
  • ClassicInternetRx: the average inbound Internet traffic over the classic network
  • ClassicInternetTx: the average outbound Internet traffic over the classic network
  • VpcInternetRx: the average inbound Internet traffic over a virtual private cloud (VPC)
  • VpcInternetTx: the average outbound Internet traffic over a VPC
  • IntranetRx: the average inbound traffic over the internal network
  • IntranetTx: the average outbound traffic over the internal network

Valid values of MetricName when ScalingRuleType is set to PredictiveScalingRule:

  • CpuUtilization: the average CPU utilization
  • IntranetRx: the average inbound traffic over the internal network
  • IntranetTx: the average outbound traffic over the internal network
TargetValueFloatNo0.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 contain up to three decimal places.

DisableScaleInBooleanNotrue

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

ScaleInEvaluationCountIntegerNo15

The number of consecutive times that the event-triggered task created for scale-ins meets the threshold conditions before an alert is triggered. After a target tracking scaling rule is created, an event-triggered task is automatically created and associated with the target tracking scaling rule.

ScaleOutEvaluationCountIntegerNo3

The number of consecutive times that the event-triggered task created for scale-outs meets the threshold conditions before an alert is triggered. After a target tracking scaling rule is created, an event-triggered task is automatically created and associated with the target tracking scaling rule.

PredictiveScalingModeStringNoPredictAndScale

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.
PredictiveValueBehaviorStringNoMaxOverridePredictiveValue

The action 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 this ratio is greater than the initial maximum capacity.
PredictiveValueBufferIntegerNo50

The ratio based on which the predicted value is increased when PredictiveValueBehavior is set 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.

PredictiveTaskBufferTimeIntegerNo30

The amount of buffer time before the prediction task is executed. By default, all prediction tasks that are automatically created by a predictive scaling rule are executed on the hour. You can set a buffer time to execute prediction tasks and prepare resources in advance. Valid values: 0 to 60.

InitialMaxSizeIntegerNo100

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

StepAdjustment.N.MetricIntervalUpperBoundFloatNo5.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.ScalingAdjustmentIntegerNo1

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.MetricIntervalLowerBoundFloatNo1.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.DimensionKeyStringNorulePool

The dimension key of the metric.

AlarmDimension.N.DimensionValueStringNosgp-l1cbirz451yxu2****

The dimension value of the metric.

Response parameters

ParameterTypeExampleDescription
RequestIdString473469C7-AA6F-4DC5-B3DB-A3DC0DE3****

The ID of the request.

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****"}]
&<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 error message returned because 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 error message returned because the scaling rule name already exists.

400

QuotaExceeded.ScalingRule

Scaling rule quota exceeded in the specified scaling group.

The error message returned because 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 error message returned because target tracking scaling rules do not support the specified metric.

400

TargetTrackingScalingRule.DumplicateMetric

Only one TargetTrackingScaling rule for a given metric specification is allowed.

The error message returned because the metric is already specified for a target tracking scaling rule in the scaling group.

400

InvalidMinAdjustmentMagnitudeMismatchAdjustmentType

MinAdjustmentMagnitude is not supported by the specified adjustment type.

The error message returned because MinAdjustmentMagnitude cannot take effect for the adjustment method of the scaling rule.

400

InvalidStepAdjustments.MultipleNullUpperBound

At most one StepAdjustment may have an unspecified upper bound.

The error message returned because a step adjustment for which an upper limit is not specified already exists.

400

InvalidStepAdjustments.MultipleNullLowerBound

At most one StepAdjustment may have an unspecified lower bound.

The error message returned because a step adjustment for which a lower limit is not specified 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 ranges of step adjustments have gaps.

400

InvalidStepAdjustments.Overlap

StepAdjustment intervals can not overlap.

The error message returned because the 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 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 and the lower limit of a step adjustment are not 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 the scaling group has been reached.

400

StepBeyondPermitRange

Specific parameter "%s" beyond permit range.

The error message returned because the upper limit or lower limit of a step adjustment is invalid.