All Products
Search
Document Center

Auto Scaling:ExecuteScalingRule

更新時間:Jun 13, 2024

Executes a scaling rule. You can manually execute scaling rules to adjust the number of ECS instances or elastic container instances. You can also enable Auto Scaling to execute scaling rules. You must manually call the ExecuteScalingRule operation to execute simple scaling rules and step scaling rules. Auto Scaling can execute only target tracking scaling rules and predictive scaling rules.

Usage notes

Before you call the ExecuteScalingRule operation, make sure that the following requirements are met:

  • The following requirements must be met:

    • The specified scaling group is in the Active state.

    • The scaling group does not have scaling activities in progress.

  • If the scaling group has no scaling activities in progress, the operation can trigger scaling activities even before the cooldown period of the scaling group expires.

  • If the addition of a specific number of Elastic Compute Service (ECS) instances to the scaling group causes the total number of ECS instances in the scaling group to exceed the maximum allowed number, Auto Scaling stops adding ECS instances to the scaling group when the total number of instances is equal to the maximum allowed number.

  • If the removal of a specific number of ECS instances from the scaling group causes the total number of ECS instances in the scaling group to be less than the minimum allowed number, Auto Scaling stops removing ECS instances from the scaling group when the total number of instances is equal to the minimum allowed number.

A successful call indicates that Auto Scaling has accepted the request. Nevertheless, the scaling activity itself may still fail. You can obtain the status of a scaling activity based on the value of ScalingActivityId in the response.

Note

You can add or remove only a limited number of ECS instances at a time. For more information, see the AdjustmentValue parameter in CreateScalingRule.

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

ExecuteScalingRule

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

ScalingRuleAri

String

Yes

ari:acs:ess:cn-hangzhou:140692647406****:scalingrule/asr-bp1dvirgwkoowxk7****

The unique identifier of the scaling rule.

Note

You can call this operation to execute only simple scaling rules and step scaling rules. If you want to execute a step scaling rule, you must specify BreachThreshold and MetricValue.

ClientToken

String

No

123e4567-e89b-12d3-a456-426655440000

The client token that is used to ensure the idempotence of the request.

You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see Ensure idempotence.

BreachThreshold

Float

No

1.0

The breach threshold of the step scaling rule. Valid values: -9.999999E18 to 9.999999E18.

MetricValue

Float

No

1.0

The metric value of the step scaling rule. Valid values: -9.999999E18 to 9.999999E18.

RegionId

String

No

cn-qingdao

The region ID of the scaling rule.

Response parameters

Parameter

Type

Example

Description

ScalingActivityId

String

asa-bp13o672yeautiil****

The ID of the scaling activity.

RequestId

String

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

The request ID.

Examples

Sample requests

http(s)://ess.aliyuncs.com/?Action=ExecuteScalingRule
&ScalingRuleAri=ari:acs:ess:cn-hangzhou:140692647406****:scalingrule/asr-bp1dvirgwkoowxk7****
&ClientToken=123e4567-e89b-12d3-a456-426655440000
&BreachThreshold=1.0
&MetricValue=1.0
&RegionId=cn-qingdao
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<ExecuteScalingRuleResponse>
    <ScalingActivityId>asa-bp13o672yeautiil****</ScalingActivityId>
    <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3****</RequestId>
</ExecuteScalingRuleResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "ScalingActivityId" : "asa-bp13o672yeautiil****",
  "RequestId" : "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****"
}

Error codes

For a list of error codes, see Service error codes.

HttpCode

Error code

Error message

Description

404

InvalidScalingRuleAri.NotFound

The specified scaling rule Ari does not exist.

The specified scaling rule does not exist in the Alibaba Cloud account.

403

Forbidden.Unauthorized

A required authorization for the specified action is not supplied.

Auto Scaling is not authorized to call the operation.

400

IncorrectScalingGroupStatus

The current status of the specified scaling group does not support this action.

The scaling group to which the specified scaling rule belongs is not in the Active state.

400

ScalingActivityInProgress

You cannot delete a scaling group or launch a new scaling activity while there is a scaling activity in progress for the specified scaling group.

The scaling group of the specified scaling rule has a scaling activity in progress.

400

InsufficientBalance

Your account does not have enough balance.

The balance of your Alibaba Cloud account is insufficient.

400

QuotaExceed.Instance

Living instance quota exceeded.

The maximum number of ECS instances has been reached.

400

IncorrectLoadBalancerStatus

The current status of the specified load balancer does not support this action.

The load balancer that is attached to the scaling group of the specified scaling rule is not in the Active state.

400

IncorrectLoadBalancerHealthCheck

The current health check type of specified load balancer does not support this action.

The Health Check feature is not enabled for the load balancer that is attached to the scaling group of the specified scaling rule.

400

InvalidLoadBalancerId.IncorrectInstanceNetworkType

The network type of the instance in specified load balancer does not support this action.

The network type of an ECS instance that is attached to the load balancer in use is different from the network type of the scaling group.

400

InvalidLoadBalancerId.VPCMismatch

The specified virtual switch and the instance in specified load balancer are not in the same VPC.

An ECS instance that is attached to the specified load balancer does not reside in the same VPC as the vSwitch that is specified by VSwitchId.

400

IncorrectDBInstanceStatus

The current status of DB instance "XXX" does not support this action.

The ApsaraDB RDS instance that is attached to the scaling group of the specified scaling rule is not in the Running state.

400

QuotaExceeded.DBInstanceSecurityIP

Security IP quota exceeded in DB instance "XXX".

The maximum number of IP addresses in the IP address whitelist of the ApsaraDB RDS instance that is attached to the scaling group of the specified scaling rule has been reached.

400

QuotaExceeded.SecurityGroupInstance

Instance quota exceeded in the specified security group.

The maximum number of ECS instances that are associated with the specified security group has been reached.

400

IncorrectCapacity.NoChange

To execute the specified scaling rule, the total capacity will not change.

The number of instances in the scaling group remains unchanged after the scaling rule is executed.

400

QuotaExceeded.ScalingInstance

Scaling instance quota exceeded.

The maximum number of ECS instances that is allowed has been reached.

400

QuotaExceeded.AfterpayInstance

Living afterpay instance quota exceeded.

The maximum number of pay-as-you-go ECS instances that is allowed has been reached.

400

ResourceNotAvailable.ECS

The specified region or zone does not offer the specified disk or instance category.

The ECS instances of the specified instance type or that use the specified disk category cannot be created in the specified region.

400

ScalingRule.InvalidScalingRuleType

Specific scaling rule type: %s can not be executed.

The specified type of scaling rule cannot be executed.

400

InvalidStepAdjustments.NoStepFound

No adjustment step found for a metric value of: %s.

No matching adjustment steps are found for the specified metric.

400

MissingParameter.MetricValue

Metric value must be specified for StepScalingRule.

No metric value is specified for the step scaling rule.

400

MissingParameter.BreachThreshold

Breach threshold must be specified for StepScalingRule.

No threshold is specified for the step scaling rule.

400

MetricValueBeyondPermitRange

Specific parameter "%s" beyond permit range.

The specified metric value is invalid.

400

BreachThresholdBeyondPermitRange

Specific parameter "%s" beyond permit range.

The specified threshold is invalid.