执行一条伸缩规则。
接口说明
调用该接口需注意以下几点:
-
调用该接口前,请确保满足以下条件:
- 伸缩组处于
Active状态。 - 伸缩组没有执行中的伸缩活动。
- 伸缩组处于
-
当伸缩组没有执行中的伸缩活动时,该接口可以绕过冷却时间(Cooldown)直接执行伸缩活动。
-
如果伸缩规则需要增加的 ECS 实例数加上当前伸缩组的实例数(Total Capacity)大于最大实例数(MaxSize),则按 Total Capacity=MaxSize 执行伸缩活动。
-
如果当前伸缩组的实例数(Total Capacity)减去伸缩规则需要减少的 ECS 实例数小于最小实例数(MinSize),则按 Total Capacity=MinSize 执行伸缩活动。
调用该接口返回成功,只是表示弹性伸缩服务接受了该接口的调用请求,可以执行伸缩活动,但不代表伸缩活动能够执行成功。您需要通过返回的ScalingActivityId查看该伸缩活动的执行状态。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
授权信息
下表是API对应的授权信息,可以在RAM权限策略语句的Action元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:
- 操作:是指具体的权限点。
- 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。
- 资源类型:是指操作中支持授权的资源类型。具体说明如下:
- 对于必选的资源类型,用前面加 * 表示。
- 对于不支持资源级授权的操作,用
全部资源表示。
- 条件关键字:是指云产品自身定义的条件关键字。
- 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。
| 操作 | 访问级别 | 资源类型 | 条件关键字 | 关联操作 |
|---|---|---|---|---|
| ess:ExecuteScalingRule | update | *ScalingGroup acs:ess:{#regionId}:{#accountId}:scalinggroup/{#ScalingGroupId} |
| 无 |
请求参数
| 名称 | 类型 | 必填 | 描述 | 示例值 |
|---|---|---|---|---|
| ScalingRuleAri | string | 是 | 伸缩规则唯一标识符。 说明
调用 API 执行伸缩规则时,只支持执行简单规则和步进规则,且执行步进规则时必须同时指定 BreachThreshold和MetricValue参数。
| ari:acs:ess:cn-hangzhou:140692647406****:scalingrule/asr-bp1dvirgwkoowxk7**** |
| ClientToken | string | 否 | 用于保证请求的幂等性。 由客户端生成该参数值,要保证在不同请求间唯一,最大不超过 64 个 ASCII 字符。更多信息,请参见如何保证幂等性。 | 123e4567-e89b-12d3-a456-426655440000 |
| BreachThreshold | float | 否 | 执行步进伸缩规则时指定的当前阈值,取值范围:-9.999999E18~9.999999E18。 | 1.0 |
| MetricValue | float | 否 | 执行步进伸缩规则时指定的当前指标值,取值范围:-9.999999E18~9.999999E18。 | 1.0 |
| RegionId | string | 否 | 伸缩规则所属地域 ID。 | cn-qingdao |
返回参数
示例
正常返回示例
JSON格式
{
"ScalingActivityId": "asa-bp13o672yeautiil****",
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****"
}错误码
访问错误中心查看更多错误码。
变更历史
| 变更时间 | 变更内容概要 | 操作 |
|---|---|---|
| 2025-02-25 | OpenAPI 描述信息更新 | 查看变更详情 |
| HttpCode | 错误码 | 错误信息 | 描述 |
|---|---|---|---|
| 404 | InvalidScalingRuleAri.NotFound | The specified scaling rule Ari does not exist. | 指定的伸缩规则在该账号下不存在。 |
| 403 | Forbidden.Unauthorized | A required authorization for the specified action is not supplied. | 您并未向弹性伸缩完整授权 OpenAPI 接口。 |
| 400 | IncorrectScalingGroupStatus | The current status of the specified scaling group does not support this action. | 指定伸缩规则所属的伸缩组未处于 Active 状态。 |
| 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. | 指定伸缩规则所属的伸缩组有伸缩活动正在进行。 |
| 400 | InsufficientBalance | Your account does not have enough balance. | 账号余额不足。 |
| 400 | QuotaExceed.Instance | Living instance quota exceeded. | ECS 实例个数达到上限。 |
| 400 | IncorrectLoadBalancerStatus | The current status of the specified load balancer does not support this action. | 指定伸缩规则所属的伸缩组的负载均衡实例未处于 active 状态。 |
| 400 | IncorrectLoadBalancerHealthCheck | The current health check type of specified load balancer does not support this action. | 指定伸缩规则所属的伸缩组的负载均衡实例未开启健康检查。 |
| 400 | InvalidLoadBalancerId.IncorrectInstanceNetworkType | The network type of the instance in specified load balancer does not support this action. | 指定的负载均衡实例含有的 ECS 实例的网络类型与伸缩组的网络类型不匹配。 |
| 400 | InvalidLoadBalancerId.VPCMismatch | The specified virtual switch and the instance in specified load balancer are not in the same VPC. | 指定的伸缩组的负载均衡实例含有的 ECS 实例与 VSwitchId 不在同一个 VPC 当中。 |
| 400 | IncorrectDBInstanceStatus | The current status of DB instance "XXX" does not support this action. | 指定伸缩规则所属的伸缩组的 RDS 实例未处于 running 状态。 |
| 400 | QuotaExceeded.DBInstanceSecurityIP | Security IP quota exceeded in DB instance "XXX". | 指定伸缩规则所属的伸缩组的 RDS 实例访问白名单的 IP 个数达到上限。 |
| 400 | QuotaExceeded.SecurityGroupInstance | Instance quota exceeded in the specified security group. | 指定的安全组已添加的 ECS 实例个数达到上限。 |
| 400 | IncorrectCapacity.NoChange | To execute the specified scaling rule, the total capacity will not change. | 伸缩规则未造成伸缩组实例数的变化。 |
| 400 | QuotaExceeded.ScalingInstance | Scaling instance quota exceeded. | 弹性伸缩的 ECS 实例使用个数达到上限。 |
| 400 | QuotaExceeded.AfterpayInstance | Living afterpay instance quota exceeded. | 按量付费 ECS 实例的使用个数达到上限。 |
| 400 | ResourceNotAvailable.ECS | The specified region or zone does not offer the specified disk or instance category. | 指定的区域无法创建指定的 ECS 实例类型或磁盘类型。 |
| 400 | ScalingRule.InvalidScalingRuleType | Specific scaling rule type: %s can not be executed. | 无法执行当前类型的伸缩规则。 |
| 400 | InvalidStepAdjustments.NoStepFound | No adjustment step found for a metric value of: %s. | 未找到符合条件的分步执行步骤。 |
| 400 | MissingParameter.MetricValue | Metric value must be specified for StepScalingRule. | 执行分步伸缩规则必须指定指标值。 |
| 400 | MissingParameter.BreachThreshold | Breach threshold must be specified for StepScalingRule. | 执行分步伸缩规则必须指定阈值。 |
| 400 | MetricValueBeyondPermitRange | Specific parameter "%s" beyond permit range. | 指标值超过了可选范围。 |
| 400 | BreachThresholdBeyondPermitRange | Specific parameter "%s" beyond permit range. | 阈值超过了可选范围。 |
