开发者社区> 问答> 正文

伸缩组:启用伸缩组



描述


  • 启用一个指定的伸缩组。启用伸缩组成功以后(active 状态),会先把接口中指定的 ECS 实例加入伸缩组。
  • 接口中指定的 ECS 实例成功加入伸缩组后,如果当前 ECS 实例数量仍小于 MinSize,则弹性伸缩服务会自动创建差额的按量付费的 ECS 实例。例:创建伸缩组时,指定 MinSize = 5,在启用伸缩组的 InstanceId.N 参数中指定 2 台已有 ECS 实例,则弹性伸缩在加入 2 台已有 ECS 实例之后,再自动创建 3 台 ECS 实例。

当伸缩组为 Inactive 状态,才可以调用该接口。
当伸缩组没有生效的伸缩配置时,启动伸缩组时需要传入伸缩配置。
  • 一个伸缩组在同一时刻只能有一个 生效 的伸缩配置。
  • 如果启动伸缩组之前已经有生效的伸缩配置,在此接口传入新的生效伸缩配置后,原有的伸缩配置会失效。

加入的 ECS 实例的限定条件:
  • 加入的 ECS 实例必须与伸缩组在同一个地域。
  • 加入的 ECS 实例的规格(InstanceType)必须与生效伸缩配置的实例规格完全一致。
  • 加入的 ECS 实例必须是 running 状态。
  • 加入的 ECS 实例不能已加入到其它伸缩组中。
  • 加入的 ECS 实例支持包年包月和按量付费两种类型。
  • 如果伸缩组指定 VswitchID,则不支持 Classic 类型的 ECS 实例加入伸缩组,也不支持其他 VPC 的 ECS 实例加入伸缩组。
  • 如果伸缩组没有指定 VswitchID,则不支持 VPC 类型的 ECS 实例加入伸缩组。

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

请求参数

名称类型是否必须描述
ActionString操作接口名,系统规定参数,取值:EnableScalingGroup。
ScalingGroupIdString伸缩组的 ID。
ActiveScalingConfigurationIdString需要在伸缩组内激活的伸缩配置的 ID。
InstanceId.NString启用后需要加入伸缩组的 ECS 实例的 ID。最多可以输入 20 个。


返回参数


公共参数。

错误码


关于所有接口的通用性错误,请参考 客户端错误表服务器端错误表
错误错误代码描述HTTP 状态码
指定的伸缩组在该用户账号下不存在。InvalidScalingGroupId.NotFoundThe specified scaling group does not exist.404
用户并未向弹性伸缩完整授权 Open API 接口。Forbidden.UnauthorizedA required authorization for the specified action is not supplied.403
指定的伸缩组为 deleting 状态。IncorrectScalingGroupStatusThe current status of the specified scaling group does not support this action.400
指定的伸缩配置不存在指定的伸缩组中。InvalidScalingConfigurationId.NotFoundThe specified scaling configuration does not exist.404
指定的伸缩配置的实例规格与当前生效的伸缩配置的实例规格不匹配。InvalidScalingConfigurationId.InstanceTypeMismatchThe specified scaling configuration and existing active scaling configuration have different instance type.400
伸缩组中未指定生效的伸缩配置。MissingActiveScalingConfigurationAn active scaling configuration for the specified scaling group is not supplied.400
指定的 ECS 实例在该用户账号下不存在。InvalidInstanceId.NotFoundInstance “XXX” does not exist.404
指定的 ECS 实例与伸缩组所处的地域不匹配。InvalidInstanceId. RegionMismatchInstance “XXX” and the specified scaling group are not in the same Region.400
指定的 ECS 实例与伸缩配置的实例规格不匹配。InvalidInstanceId. InstanceTypeMismatchInstance “XXX” and existing active scaling configuration have different instance type.400
指定的ECS实例为非running状态IncorrectInstanceStatusThe current status of instance “XXX” does not support this action.400
指定的ECS实例的网络类型与伸缩组的网络类型不匹配。InvalidInstanceId. NetworkTypeMismatchThe network type of instance “XXX” does not support this action.400
指定的伸缩组与添加的 ECS 实例不在同一个 VPC 当中。InvalidInstanceId.VPCMismatchInstance “XXX” and the specified scaling group are not in the same VPC.400
指定的 ECS 实例已加入其它伸缩组。InvalidInstanceId.InUseInstance “XXX” is already attached to another scaling group.400
指定的负载均衡实例为非 active 状态。IncorrectLoadBalancerStatusThe current status of the specified load balancer does not support this action.400
指定的负载均衡实例未开启健康检查。IncorrectLoadBalancerHealthCheckThe current health check type of specified load balancer does not support this action.400
指定的负载均衡实例含有的 ECS 实例的网络类型与伸缩组的网络类型不匹配。InvalidLoadBalancerId.IncorrectInstanceNetworkTypeThe network type of the instance in specified Load Balancer does not support this action.400
指定的伸缩组的负载均衡实例含有的 ECS 实例与 VSwitchId 不在同一个 VPC 当中。InvalidLoadBalancerId.VPCMismatchThe specified virtual switch and the instance in specified Load Balancer are not in the same VPC.400
指定的 RDS 实例为非 running 状态。IncorrectDBInstanceStatusThe current status of DB instance “XXX” does not support this action.400
加入的 ECS 实例数使得 Total Capacity 超过 MaxSize。IncorrectCapacity.MaxSizeTo attach the instances, the total capacity will be greater than the max size.400


示例



请求示例


http://ess.aliyuncs.com/?Action=EnableScalingGroup
&ScalingGroupId=dmIDKNcyWfzncX9MWX1bwFV
&InstanceId.1=i-283vvyytn
&<公共请求参数>

返回示例
XML格式:
< EnableScalingGroupResponse>
    <RequestId>6469DCD0-13AC-487E-85A0-CE4922908FDE</RequestId>
</ EnableScalingGroupResponse>
JSON格式:
{
    "RequestId": "6469DCD0-13AC-487E-85A0-CE4922908FDE"
}


展开
收起
青蛙跳 2018-08-17 13:29:31 1328 0
0 条回答
写回答
取消 提交回答
问答排行榜
最热
最新

相关电子书

更多
k8s自动伸缩那些事资料下载 立即下载
弹性云的核心--基于热迁移的弹性调度 立即下载
基于流量的灰度发布和自动弹性实践 立即下载