You can call this operation to modify 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

Parameter Type Required Example Description
ScalingRuleId String Yes eMKWG8SRNb9dBLAjweN****

The ID of the scaling rule to be modified.

Action String No ModifyScalingRule

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

AdjustmentType String No QuantityChangeInCapacity

The method used by the scaling rule to adjust the number of ECS instances. This parameter is applicable only to simple scaling rules. Valid values:

  • QuantityChangeInCapacity: adds or removes a specified number of ECS instances.
  • PercentChangeInCapacity: adds or removes a specified percentage of ECS instances.
  • TotalCapacity: adds or removes ECS instances to ensure that the current scaling group has a specified number of ECS instances.
AdjustmentValue Integer No 100

The number of ECS instances to be adjusted by the scaling rule. This parameter is applicable only to simple scaling rules. The number of ECS instances to be adjusted in a single scaling activity cannot exceed 500. Valid values:

  • QuantityChangeInCapacity: -500 to 500
  • PercentChangeInCapacity: -100 to 10000
  • TotalCapacity: 0 to 1000
Cooldown Integer No 60

The cooldown time of the scaling rule. This parameter is applicable only to simple scaling rules.

Valid values: 0 to 86400. Unit: seconds.

DisableScaleIn Boolean No true

Specifies whether to disable scale-in. This parameter is applicable only to target tracking scaling rules.

EstimatedInstanceWarmup Integer No 60

The warm-up period of the ECS instances. This parameter is applicable to target tracking scaling rules and step scaling rules. The system adds ECS instances that are in the warm-up state to the scaling group, but does not report monitoring data during the warm-up period to CloudMonitor.

Note When calculating the number of ECS instances to be adjusted, the system does not count ECS instances in the warm-up state as part of the current capacity of the scaling group.

Valid values: 0 to 86400. Unit: seconds.

InitialMaxSize Integer No 100

The maximum number of ECS instances in the scaling group, which is used together with PredictiveValueBehavior.

MetricName String No CpuUtilization

The predefined metric to monitor. This parameter is required and applicable only to target tracking scaling rules and predictive scaling rules.

Valid values of a target tracking scaling rule:

  • CpuUtilization: the average CPU utilization
  • ClassicInternetRx: the average public network inbound traffic over the classic network
  • ClassicInternetTx: the average public network outbound traffic over the classic network
  • VpcInternetRx: the average public network inbound traffic over the VPC
  • VpcInternetTx: the average public network outbound traffic over the VPC
  • IntranetRx: the average internal network inbound traffic
  • IntranetTx: the average internal network outbound traffic

Valid values of a predictive scaling rule:

  • CpuUtilization: the average CPU utilization
  • IntranetRx: the average internal network inbound traffic
  • IntranetTx: the average internal network outbound traffic
MinAdjustmentMagnitude Integer No 1

The minimum number of ECS instances to be adjusted in a scaling rule. This parameter takes effect only when the scaling rule type is SimpleScalingRule or StepScalingRule and AdjustmentType is PercentChangeInCapacity.

PredictiveScalingMode String No PredictAndScale

The mode of the predictive scaling rule. Valid values:

  • PredictAndScale: generates forecasts and creates forecast tasks.
  • PredictOnly: generates forecasts but does not create forecast tasks.
PredictiveTaskBufferTime Integer No 30

The amount of buffer time ahead of the forecast task execution time. By default, all scheduled tasks that are automatically created for a predictive scaling rule are executed at the beginning of each hour. You can set a buffer time to execute forecast tasks ahead of schedule, so that resources can be prepared in advance. Valid values: 0 to 60.

PredictiveValueBehavior String No MaxOverridePredictiveValue

The action taken on the predicted maximum value. Valid values:

  • MaxOverridePredictiveValue: uses the initial maximum capacity as the maximum value for forecast tasks when the predicted value is greater than the initial maximum capacity.
  • PredictiveValueOverrideMax: uses the predicted value as the maximum value for forecast tasks when the predicted value is greater than the initial maximum capacity.
  • PredictiveValueOverrideMaxWithBuffer: increases the predicted value with a ratio, which is specified by PredictiveValueBuffer. If the value after the increase is greater than the initial maximum capacity, the value after the increase is used as the maximum value for forecast tasks.
PredictiveValueBuffer Integer No 50

The ratio of the increment to the predicted value when PredictiveValueBehavior is set to PredictiveValueOverrideMaxWithBuffer. When the value after the increase is greater than the initial maximum capacity, the value after the increase is used for forecast tasks. Valid values: 0 to 100.

ScalingRuleName String No TestSr

The display name of the scaling rule. It must be 2 to 40 characters in length. It must start with a digit, uppercase letter, or lowercase letter. It can contain letters, digits, underscores (_), hyphens (-), and periods (.). The name of a scaling rule must be unique within the scaling group to which it belongs.

StepAdjustment.N.MetricIntervalLowerBound Float No 1.0

The lower limit value specified in step adjustment N. Valid values: -9.999999E18 to 9.999999E18.

StepAdjustment.N.MetricIntervalUpperBound Float No 5.0

The upper limit value specified in step adjustment N. Valid values: -9.999999E18 to 9.999999E18.

StepAdjustment.N.ScalingAdjustment Integer No 1

The specified number of ECS instances to be adjusted in step adjustment N.

TargetValue Float No 0.125

The target value of the metric. This parameter is applicable only to target tracking scaling rules and predictive scaling rules. The value of TargetValue must be greater than 0 and can have a maximum of three decimal places.

Response parameters

Parameter Type Example Description
RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

The ID of the request.

Examples

Sample requests


http://ess.aliyuncs.com/?Action=ModifyScalingRule
&ScalingGroupId=AG6CQdPU8OKdwLjgZcJ****
&AdjustmentType=QuantityChangeInCapacity
&AdjustmentValue=-10
&<Common request parameters>

Sample success responses

XML format

<ModifyScalingRuleResponse>
      <ScalingRuleAri>ari:acs:ess:cn-qingdao:1344371:scalingrule/eMKWG8SRNb9dBLAjweN****</ScalingRuleAri>
      <ScalingRuleId>eMKWG8SRNb9dBLAjweN****</ScalingRuleId>
      <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E</RequestId>
</ModifyScalingRuleResponse>

JSON format

{
	"ScalingRuleAri":"ari:acs:ess:cn-qingdao:1344371:scalingrule/eMKWG8SRNb9dBLAjweN****",
	"RequestId":"473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E",
	"ScalingRuleId":"eMKWG8SRNb9dBLAjweN****"
}

Error codes

For more information about error codes, visit API Error Center.

HTTP status code

Error code

Error message

Description

404

InvalidScalingGroupId.NotFound

The specified scaling group does not exist.

The error message returned because the specified scaling group does not exist in the current 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 specified 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 monitoring metric.

400

TargetTrackingScalingRule.DumplicateMetric

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

The error message returned because the monitoring 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 the MinAdjustmentMagnitude parameter cannot be applied to the specified 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 with an unspecified upper limit value already exists.

400

InvalidStepAdjustments.MultipleNullLowerBound

At most one StepAdjustment may have an unspecified lower bound.

The error message returned because a step adjustment with an unspecified lower limit value 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 value of a step adjustment is negative, but a different step adjustment with an unspecified lower limit value 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 value of a step adjustment is positive, but a different step adjustment with an unspecified upper limit value does not exist.

400

InvalidStepAdjustments.Gap

StepAdjustment intervals cannot have gaps between them.

The error message returned because the specified ranges of step adjustments have gaps between them.

400

InvalidStepAdjustments.Overlap

StepAdjustment intervals cannot 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 value.

400

InvalidStepAdjustments.BothNull

Both lower and upper bounds of a StepAdjustment cannot be left unspecified.

The error message returned because neither the upper limit value nor the lower limit value for a step adjustment is 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 value or lower limit value of a step adjustment is beyond the range of valid values.