开发者社区> 问答> 正文

弹性伸缩触发任务有哪些API?

弹性伸缩触发任务有哪些API?

展开
收起
小天使爱美 2020-03-24 19:50:05 721 0
1 条回答
写回答
取消 提交回答
  • 调用ExecuteScalingRule执行一条伸缩规则。

    接口说明 调用该接口前请确保满足以下条件:

    伸缩组为Active状态。 伸缩组没有伸缩活动正在执行。 当伸缩组没有伸缩活动正在执行时,该接口可以绕过冷却时间(Cooldown)直接执行。

    调用该接口返回成功,只是表示弹性伸缩服务接受了该接口的调用请求,伸缩活动可以执行,但不代表伸缩活动能够执行成功。用户需要通过返回的ScalingActivityId查看该伸缩活动的执行状态。

    如果该伸缩规则需要增加的ECS实例数加上当前伸缩组的实例数(Total Capacity)大于MaxSize,则按Total Capacity = MaxSize的规则进行执行。

    如果当前伸缩组的实例数(Total Capacity)减去该伸缩规则需要减少的ECS实例数小于MinSize,则按Total Capacity = MinSize的规则进行执行。

    对于所有地域和所有伸缩组,一个用户最多能弹性伸缩1000台ECS实例。(此数量只包含自动创建的ECS实例,不包含手工添加的ECS实例。)

    调试 您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

    调试 请求参数 名称 类型 是否必选 示例值 描述 Action String 否 ExecuteScalingRule 系统规定参数,取值:ExecuteScalingRule。

    ScalingRuleAri String 是 ari:acs:ess:cn-hangzhou:1406926474064770:scalingrule/asr-bp1dvirgwkoowxk7**** 伸缩规则唯一标识符。

    ClientToken String 否 123e4567-e89b-12d3-a456-426655440000 用于保证请求的幂等性。由客户端生成该参数值,要保证在不同请求间唯一,最大不超过64个ASCII字符。详情请参见如何保证幂等性。

    BreachThreshold Float 否 1.0 执行步进伸缩规则时指定的当前阈值,取值范围:-9.999999E18~9.999999E18。

    MetricValue Float 否 1.0 执行步进伸缩规则时指定的当前指标值,取值范围:-9.999999E18~9.999999E18。

    返回数据 名称 类型 示例值 描述 ScalingActivityId String asa-bp13o672yeautiil**** 伸缩活动的ID。

    RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E 请求ID。

    示例 请求示例

    http://ess.aliyuncs.com/?Action=ExecuteScalingRule &ScalingRuleAri=ari:acs:ess:cn-hangzhou:1406926474064770:scalingrule/asr-bp1dvirgwkoowxk7**** &<公共请求参数> 正常返回示例

    XML 格式

    asa-bp13o672yeautiil**** 473469C7-AA6F-4DC5-B3DB-A3DC0DE3**** JSON 格式

    { "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E", "ScalingActivityId": "asa-bp13o672yeautiil****" } 错误码 访问错误中心查看更多错误码。

    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.

    用户并未向弹性伸缩完整授权Open API接口。

    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.

    阈值超过了可选范围。调用AttachInstances为伸缩组添加ECS实例。

    接口说明 加入的ECS实例的限定条件包括:

    加入的ECS实例必须与伸缩组在同一个地域。 加入的ECS实例必须处于Running状态。 加入的ECS实例不能已加入到其它伸缩组中。 加入的ECS实例支持包年包月和按量付费两种类型。 如果伸缩组指定VswitchID,则不支持Classic类型的ECS实例加入伸缩组,也不支持其他VPC的ECS实例加入伸缩组。 如果伸缩组没有指定VswitchID,则不支持VPC类型的ECS实例加入伸缩组。 当伸缩组处于Active状态时,才可以调用该接口。

    当伸缩组没有伸缩活动正在执行时,才可以调用该接口。

    当伸缩组没有伸缩活动正在执行时,该接口可以绕过冷却时间(Cooldown)直接执行。

    调用该接口返回成功,只是表示弹性伸缩服务接受了该接口调用的请求,伸缩活动可以执行,但不代表伸缩活动能够执行成功。您需要通过返回的ScalingActivityId查看该伸缩活动的执行状态。

    如果该接口指定的实例数加上当前伸缩组的实例数(Total Capacity)大于MaxSize,则调用失败。

    手工添加的ECS实例不与伸缩组生效的伸缩配置进行关联。

    调试 您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

    调试 请求参数 名称 类型 是否必选 示例值 描述 Action String 否 AttachInstances 系统规定参数,取值:AttachInstances。

    InstanceId.1 String 是 i-28wt4**** InstanceId.N为待添加ECS实例的ID,N的取值范围:1~20。

    ScalingGroupId String 是 asg-bp18p2yfxow2dloq**** 伸缩组的ID。

    LoadBalancerWeight.1 Integer 否 50 LoadBalancerWeight.N为对应ECS实例后端服务器的权重,N的取值范围:1~20,该参数取值范围:1~100。

    默认值:50。

    Entrusted Boolean 否 false 手动添加实例到伸缩组时,是否将实例托管给伸缩组,托管状态的手动添加实例,在移除伸缩组(不包括手动移除)时,将执行释放操作。取值范围:

    true:将实例托管给伸缩组。 false:不将实例托管给伸缩组。 默认值:false。

    返回数据 名称 类型 示例值 描述 ScalingActivityId String asa-bp1crxor24s28xf1**** 伸缩活动的ID。

    RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E 请求ID。

    示例 请求示例

    http://ess.aliyuncs.com/?Action=AttachInstances &ScalingGroupId=asg-bp18p2yfxow2dloq**** &InstanceId.1=i-28wt4**** &<公共请求参数> 正常返回示例

    XML 格式

    asa-bp1crxor24s28xf1**** 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E JSON 格式

    { "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E", "ScalingActivityId": "asa-bp1crxor24s28xf1****" } 错误码 访问错误中心查看更多错误码。

    HttpCode

    错误码

    错误信息

    描述

    404

    InvalidScalingGroupId.NotFound

    The specified scaling group does not exist.

    指定的伸缩组在该账号下不存在。

    403

    Forbidden.Unauthorized

    A required authorization for the specified action is not supplied.

    您并未向弹性伸缩完整授权Open API接口。

    400

    IncorrectScalingGroupStatus

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

    指定的伸缩组未处于active状态。

    404

    InvalidInstanceId.NotFound

    Instance “XXX” does not exist.

    指定的ECS实例在该账号下不存在。

    400

    InvalidInstanceId. RegionMismatch

    Instance “XXX” and the specified scaling group are not in the same Region.

    指定的ECS实例与伸缩组所属的地域不匹配。

    400

    InvalidInstanceId.InstanceTypeMismatch

    Instance “XXX” and existing active scaling configurations have different instance types.

    指定的ECS实例与伸缩配置的实例规格不匹配。

    400

    IncorrectInstanceStatus

    The current status of instance “XXX” does not support this action.

    指定的ECS实例未处于running状态。

    400

    InvalidInstanceId. NetworkTypeMismatch

    The network type of instance “XXX” does not support this action.

    ECS实例的网络类型与伸缩组的网络类型不匹配。

    400

    InvalidInstanceId.VPCMismatch

    Instance “XXX” and the specified scaling group are not in the same VPC.

    指定的伸缩组与添加的ECS实例不在同一个VPC当中。

    400

    InvalidInstanceId.InUse

    Instance “XXX” is already attached to another scaling group.

    指定的ECS实例已加入其它伸缩组。

    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

    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

    he 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.MaxSize

    To attach the instances, the total capacity will be greater than the MaxSize.

    加入的ECS实例数使得Total Capacity超过MaxSize。调用RemoveInstances从一个伸缩组里移出ECS实例。

    接口说明 调用本接口前请确保满足以下条件:

    伸缩组处于启用(Active)状态。 伸缩组中没有正在执行的伸缩活动。 当伸缩组没有伸缩活动正在执行时,该接口可以绕过冷却时间(DefaultCooldown)直接执行。

    从伸缩组移出弹性伸缩自动创建的ECS实例时,ECS实例进入停机不收费状态或者被释放。

    从伸缩组移出用户手工加入的ECS实例时,不停止和释放该ECS实例。

    调用该接口返回成功,只是表示弹性伸缩服务接受了该接口调用的请求,伸缩活动可以执行,但不代表伸缩活动能够执行成功。用户需要通过返回的ScalingActivityId查看该伸缩活动的执行状态。

    如果当前伸缩组的实例数(TotalCapacity)减去该接口指定的实例数小于伸缩组内最小实例数(MinSize),则调用失败。

    调试 您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

    调试 请求参数 名称 类型 是否必选 示例值 描述 InstanceId.N RepeatList 是 i-28wt4**** 待移出ECS实例的ID。N的取值范围:1~20。

    ScalingGroupId String 是 AG6CQdPU8OKdwLjgZcJ**** 伸缩组的ID。

    Action String 否 RemoveInstances 系统规定参数,取值:RemoveInstances。

    DecreaseDesiredCapacity Boolean 否 true 是否修改期望实例数。取值范围:

    true:ECS实例分离出伸缩组后,期望实例数也减少相应台数。 false:ECS实例分离出伸缩组后,期望实例数不会变化。 默认值:true。

    RemovePolicy String 否 release 指定被移出实例的动作,取值范围:

    recycle:实例进入停机不收费状态。 说明 仅在ScalingPolicy为recycle时生效。 release:实例被释放。 默认值:release。

    返回数据 名称 类型 示例值 描述 RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E 请求ID。

    ScalingActivityId String bybj9OcaOT4ucPMbFhcq**** 伸缩活动的ID。

    示例 请求示例

    http://ess.aliyuncs.com/?Action=RemoveInstances &ScalingGroupId=AG6CQdPU8OKdwLjgZcJ**** &InstanceId.1=i-28wt4**** &<公共请求参数> 正常返回示例

    XML 格式

    bybj9OcaOT4ucPMbFhcq**** 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E JSON 格式

    { "RequestId":"473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E", "ScalingActivityId":"bybj9OcaOT4ucPMbFhcq****" } 错误码 访问错误中心查看更多错误码。

    HttpCode

    错误码

    错误信息

    描述

    404

    InvalidScalingGroupId.NotFound

    The specified scaling group does not exist.

    指定的伸缩组在该用户账号下不存在。

    404

    InvalidInstanceId.NotFound

    Instance "XXX" does not exist.

    指定的ECS实例在伸缩组下不存在。

    400

    InvalidParameter

    The specified group does not support the specified RemovePolicy.

    当前伸缩组不支持停机回收策略。

    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

    IncorrectLoadBalancerStatus

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

    指定伸缩规则所属的伸缩组的负载均衡实例未处于active状态。

    400

    IncorrectDBInstanceStatus

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

    指定伸缩规则所属的伸缩组的RDS实例未处于Running状态。

    400

    IncorrectCapacity.MinSize

    To remove the instances, the total capacity will be lesser than the MinSize.

    移出的实例数使得TotalCapacity小于MinSize。调用DetachInstances从一个伸缩组分离一台或多台ECS实例。

    接口说明 分离ECS实例之后,ECS实例可以独立于伸缩组存在,您可以调用AttachInstances接口将ECS实例附加到其他伸缩组。

    分离一台ECS实例并不会停止或释放该ECS实例,若有相关需要,您可以手动停止或释放ECS实例。

    调用该接口前,请确保满足以下条件:

    目标伸缩组必须处于启用(Enable)状态。 目标伸缩组不能有正在进行的伸缩活动。 目标伸缩组没有正在进行的伸缩活动时,该接口可以绕过冷却时间直接执行。

    接口成功调用后,仅表示接受了该接口调用的请求。可以照常触发伸缩活动,但不能保证伸缩活动执行成功,您需要通过返回的ScalingActivityId查看伸缩活动的状态。

    目标伸缩组的ECS数量减去当前分离的ECS数不能小于伸缩组最小实例数(MinSize)。

    调试 您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

    调试 请求参数 名称 类型 是否必选 示例值 描述 InstanceId.N RepeatList 是 i-28wt4**** 待分离ECS实例的ID。N的取值范围:1~20。

    ScalingGroupId String 是 AG6CQdPU8OKdwLjgZcJ**** 伸缩组的ID。

    Action String 否 DetachInstances 系统规定参数,取值: DetachInstances。

    DecreaseDesiredCapacity Boolean 否 true 是否修改期望实例数。取值范围:

    true:ECS实例分离出伸缩组后,期望实例数也减少相应台数。 false:ECS实例分离出伸缩组后,期望实例数不会变化。 默认值:true。

    返回数据 名称 类型 示例值 描述 RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E 请求ID。

    ScalingActivityId String asa-**** 伸缩活动的ID。

    示例 请求示例

    http://ess.aliyuncs.com/?Action=DetachInstances &ScalingGroupId=AG6CQdPU8OKdwLjgZcJ**** &InstanceId.1=i-28wt4**** &<公共请求参数> 正常返回示例

    XML 格式

    473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E asa-**** JSON 格式

    { "RequestId":"473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E", "ScalingActivityId":"asa-****" } 错误码 访问错误中心查看更多错误码。

    HttpCode

    错误码

    错误信息

    描述

    400

    IncorrectScalingGroupStatus

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

    目标伸缩组必须处于启用(Enable)状态。

    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

    IncorrectLoadBalancerStatus

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

    目标伸缩组内的负载均衡实例必须处于运行中(Active)状态。

    400

    IncorrectDBInstanceStatus

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

    目标伸缩组内的 RDS 实例必须处于运行中(Running)状态。

    400

    IncorrectCapacity.MinSize

    To remove the instances, the total capacity will be lesser than the MinSize.

    目标伸缩组的ECS实例数量减去当前分离的ECS实例数量不能小于伸缩组最少实例数(MinSize)。

    403

    Forbidden.Unauthorized

    A required authorization for the specified action is not supplied.

    您暂未被授权使用DetachInstances接口。

    404

    InvalidScalingGroupId.NotFound

    The specified scaling group does not exist.

    指定的伸缩组不存在。

    404

    InvalidInstanceId.NotFound

    Instance “XXX” does not exist.

    指定的ECS实例不存在。

    2020-03-24 20:06:01
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
Spring Boot2.0实战Redis分布式缓存 立即下载
CUDA MATH API 立即下载
API PLAYBOOK 立即下载