將實(shí)例加入安全組
描述
將實(shí)例加入到指定的安全組。
只有在實(shí)例狀態(tài)為 Stopped 或 Running 狀態(tài)下才可以執(zhí)行該操作。
每個(gè)實(shí)例最多屬于 5 個(gè)安全組
每個(gè)安全組最多擁有個(gè) 1000 個(gè)實(shí)例
請(qǐng)求參數(shù)
名稱(chēng)
類(lèi)型
是否必須
描述
Action
String
是
系統(tǒng)規(guī)定參數(shù),取值:JoinSecurityGroup
InstanceId
String
是
指定的實(shí)例 ID
SecurityGroupId
String
是
安全組代碼
返回參數(shù)
全是公共返回參數(shù),詳見(jiàn)公共返回參數(shù)
錯(cuò)誤碼
錯(cuò)誤代碼
描述
Http 狀態(tài)碼
語(yǔ)義
InvalidInstanceId.NotFound
The InstanceId provided does not exist in our records.
404
指定的 InstanceId 不存在
MissingParameter
The input parameter "InstanceId" that is mandatory for processing this request is not supplied.
400
缺少 InstanceId 值
InvalidSecurityGroupId.NotFound
The SecurityGroupId provided does not exist in our records.
404
指定的 SecurityGroupId 不存在
MissingParameter
The input parameter "SecurityGroupId" that is mandatory for processing this request is not supplied.
400
缺少 SecurityGroupId 值
InstanceSecurityGroupLimitExceeded
Exceeding the allowed amount of security groups that an instance can be in.
400
實(shí)例加入的安全組數(shù)量達(dá)到上限
IncorrectInstanceStatus
The current status of the resource does not support this operation.
403
該資源目前的狀態(tài)不支持此操作
InstanceLockedForSecurity
The specified operation is denied as your instance is locked for security reasons.
403
該資源目前被安全鎖定被拒絕操作
SecurityGroupInstanceLimitExceeded
Exceeding the allowed amount of instances of a security group.
403
該 SecurityGroup 內(nèi)的 Instance 數(shù)量已經(jīng)達(dá)到上限
InvalidInstanceId.Mismatch
Specified instance and security group are not in the same VPC.
403
指定的實(shí)例和安全組不屬于同一個(gè)虛擬專(zhuān)有網(wǎng)絡(luò)
(包含另外兩種特殊情況:
實(shí)例不屬于 VPC 類(lèi)型的,安全組屬于 VPC 類(lèi)型
實(shí)例屬于 VPC 類(lèi)型,安全組不屬于 VPC 類(lèi)型
)
InvalidInstanceId.AlreadyExists
The specified instance is already in the specified security group.
403
指定的實(shí)例已經(jīng)在指定的安全組中
示例
請(qǐng)求示例
https://ecs.aliyuncs.com/?Action=JoinSecurityGroup
&InstanceId= i-instance1
&SecurityGroupId=F876FF7BA984
&<公共請(qǐng)求參數(shù)>
返回示例
XML格式
473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E
JSON格式
{
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"