You need to enable JavaScript to run this app.
导航
AttachInstances - 向伸缩组手动添加实例
最近更新时间:2025.03.03 14:34:54首次发布时间:2022.05.13 10:42:45
我的收藏
有用
有用
无用
无用

手动添加一个或者多个实例到伸缩组,操作说明和注意事项请参见手动添加实例

调试

请求参数

下表仅列出该接口特有的请求参数和部分公共参数。更多信息请见公共参数

参数
类型
是否必填
示例值
描述
Action
String

AttachInstances

要执行的操作,取值:AttachInstances。

Version
String

2020-01-01

API的版本,取值:2020-01-01。

ScalingGroupId
String

scg-ybmssdnnhn5pkgyd****

伸缩组ID。您可以调用DescribeScalingGroups查询伸缩组ID。

InstanceIds.N
Array of String

i-ybmike5l70l8j1ha****

实例ID列表。您可以调用DescribeInstances接口查询实例ID。

  • 参数 - N:表示伸缩组的序号,取值1 ~ 20。
  • 多个实例ID之间用&分隔。
LifecycleHook
Boolean

false

伸缩组添加实例时是否触发扩容生命周期挂钩。取值范围:

  • true:触发。
  • false(默认):不触发。
Entrusted
Boolean

false

是否将实例托管给伸缩组,取值:

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

返回参数

下表仅列出本接口特有的返回参数。更多信息请参见返回结构

参数
类型
示例值
描述
ScalingActivityId
String

sga-ybn0mwfy1yl8j1f6****

伸缩日志ID。

请求示例

GET /?Action=AttachInstances&InstanceIds.1=i-ybmike5l70l8j1ha****&ScalingGroupId=scg-ybmssdnnhn5pkgyd****&Version=2020-01-01 HTTP/1.1
Host: open.volcengineapi.com
X-Date: 20240507T112932Z
Authorization: HMAC-SHA256 Credential=Adfks******wekfwe/20240507/cn-beijing/auto_scaling/request, SignedHeaders=host;x-date, Signature=47a7d934ff7b37c03938******cd7b8278a40a1057690c401e92246a0e41085f


返回示例

{
  "ResponseMetadata": {
    "RequestId": "20240507192941234170194230F2025B",
    "Version": "2020-01-01",
    "Service": "auto_scaling",
    "Region": "cn-beijing"
  },
  "Result": {
    "ScalingActivityId": "sga-ybn0mwfy1yl8j1f6****"
  }
}

错误码

下表为您列举了该接口与业务逻辑相关的错误码。公共错误码请参见公共错误码文档。

状态码
错误码
错误信息
说明
400
InvalidInstance.InvalidStatus

The specified Instance [%s] is not in the correct status.

指定实例的状态不支持该操作。

400
InvalidScalingGroup.InvalidStatus

The specified ScalingGroup is not in the correct status.

指定的伸缩组当前状态不支持该操作。

400
MissingParameter.ScalingGroupId

The required parameter ScalingGroupId is not supplied.

伸缩组ID不能为空。

400
InvalidInstanceIds.Malformed

The specified amount of InstanceIds is malformed.

指定的实例ID数量超出限制。

400
InvalidInstance.VPCMismatch

The primary network interface of specified Instance [%s] does not match the VPC of the scaling group.

指定实例的网卡和伸缩组VPC不匹配。

400
InvalidInstance.InvalidChargeType

The ChargeType of the specified Instance [%s] does not support this operation.

指定实例的计费类型不支持该操作。

400
InvalidInstance.InUse

The specified Instance [%s] is already in use.

指定的实例已在使用。

400
IncorrectInstanceNumber.MaxInstanceNumber

The attached ECS instances make Total InstanceNumber exceed MaxInstanceNumber.

添加的ECS实例使伸缩组实例数大于设置的最大实例数

400
InvalidOperation.Suspended

The specific operation is rejected by the suspended processes.

指定的操作被伸缩组挂起流程拒绝

404
InvalidInstanceId.NotFound

The specified InstanceId [%s] does not exist.

指定的实例不存在。

404
InvalidScalingGroupId.NotFound

The specified ScalingGroup [%s] does not exist.

指定的伸缩组不存在。

412
InvalidScalingGroup.LockFailed

The specified operation is denied as the scaling group lock failed.

锁定伸缩组失败。

429
LimitExceeded.OperateScalingGroupInstances

You've reach the limit on request rate of operating the specified scaling group instances.

频繁变更指定伸缩组实例。

500
InternalError

An internal error has occurred.

内部错误,请重试。如果多次尝试失败,请提交工单。