开发者社区> 问答> 正文

触发任务:添加ECS实例




描述


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

当伸缩组为active状态,才可以调用该接口。
当伸缩组没有伸缩活动正在执行,才可以调用该接口。
当伸缩组没有伸缩活动正在执行时,该接口可以绕过冷却时间(Cooldown)直接执行。
调用该接口返回成功,只是表示弹性伸缩服务接受了该接口调用的请求,伸缩活动可以执行,但不代表伸缩活动能够执行成功。用户需要通过返回的ScalingActivityId查看该伸缩活动的执行状态。
如果该接口指定的实例数加上当前伸缩组的实例数(Total Capacity)大于MaxSize时,则调用失败。
手工添加的ECS实例不与伸缩组生效的伸缩配置进行关联。

请求参数

名称类型是否必须描述
ActionString操作接口名,系统规定参数,取值:AttachInstances。
ScalingGroupIdString伸缩组的ID。
InstanceId.NStringECS实例的ID。最多可以输入20个。


返回参数

名称类型描述
ScalingActivityIdString伸缩活动的ID


错误码


关于所有接口的通用性错误,请参考 客户端错误表服务器端错误表
错误错误代码描述HTTP状态码
指定的伸缩组在该用户账号下不存在InvalidScalingGroupId.NotFoundThe specified scaling group does not exist.404
用户并未向弹性伸缩完整授权Open API接口Forbidden.UnauthorizedA required authorization for the specified action is not supplied.403
指定的伸缩组为非active状态IncorrectScalingGroupStatusThe current status of the specified scaling group does not support this action.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 configurations have different instance types.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
指定的伸缩组有伸缩活动正在进行ScalingActivityInProgressYou 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
指定的伸缩组的负载均衡实例为非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
指定的伸缩组的RDS实例访问白名单的IP个数达到上限QuotaExceeded.DBInstanceSecurityIPSecurity IP quota exceeded in DB instance “XXX”.400
指定的安全组已添加的ECS实例个数达到上限QuotaExceeded.SecurityGroupInstanceInstance quota exceeded in the specified security group.400
加入的ECS实例数使得Total Capacity超过MaxSizeIncorrectCapacity.MaxSizeTo attach the instances, the total capacity will be greater than the MaxSize.400


示例



请求示例

  1. http://ess.aliyuncs.com/?Action=AttachInstances
  2. &ScalingGroupId=AG6CQdPU8OKdwLjgZcJ2eaQ
  3. &InstanceId.1=i-28wt48iaa
  4. &<公共请求参数>


返回示例


XML格式:
  1. <AttachInstancesResponse>
  2.     <ScalingActivityId>bybj9OcaOT4ucPMbFhcqHfA3</ScalingActivityId>
  3.     <RequestId>DD0309B7-2613-4792-9B86-275906695253</RequestId>
  4. </AttachInstancesResponse>

JSON格式:
  1. "RequestId": "6469DCD0-13AC-487E-85A0-CE4922908FDE",
  2. "ScalingActivityId": "ebta5WbUzC8gcwUWvfchyT4U"

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

相关电子书

更多
如何运维千台以上游戏云服务器 立即下载
网站/服务器取证 实践与挑战 立即下载
ECS快储存加密技术 立即下载