To join an instance in a security group
Describe
Joins the instance to the specified security group.
You can perform this operation only if the instance state is Stopped or Running state.
Up to 5 security groups per instance
Each security group has a maximum of 1000 instances
Request parameters
name |
type |
whether you must |
Description |
Action |
String |
Is |
System specified parameters, values: Joinsecuritygroup |
Instanceid |
String |
Is |
The specified instance ID |
Securitygroupid |
String |
Is |
Security Group Code |
return parameters
All public return parameters, as detailed in the public return parameters
Error code
Error code |
Description |
Http Status Code |
Semantics |
Invalidinstanceid.notfound |
The Instanceid provided does not exist at our records. |
404 |
The specified Instanceid does not exist |
Missingparameter |
The input parameter "Instanceid" is mandatory to processing this request isn't supplied. |
400 |
Missing Instanceid value |
Invalidsecuritygroupid.notfound |
The securitygroupid provided does not exist at our records. |
404 |
The specified securitygroupid does not exist |
Missingparameter |
The input parameter "Securitygroupid" is mandatory to processing this request isn't supplied. |
400 |
Missing securitygroupid value |
instancesecuritygrouplimitexceeded |
Exceeding the allowed amount of security groups this instance can is in. |
400 |
The number of security groups added to the instance reaches the upper limit |
Incorrectinstancestatus |
The current status of the resource does is not support this operation. |
403 |
The current state of the resource does not support this operation |
Instancelockedforsecurity |
The specified operation is denied as your instance are locked for security reasons. |
403 |
The resource is currently denied operation by security lockdown |
securitygroupinstancelimitexceeded |
Exceeding the allowed amount of instances of a security group. |
403 |
The number of Instance within the Securitygroup has reached the upper limit |
Invalidinstanceid.mismatch |
Specified instance and security group are is not in the same VPC. |
403 |
The specified instance and security groups do not belong to the same virtual proprietary network (includes two other special cases:
- Instance does not belong to the VPC type, the security group belongs to the VPC type
- Instance belongs to VPC type, security group is not VPC type
) |
Invalidinstanceid.alreadyexists |
The specified instance is already on the specified security group. |
403 |
The specified instance is already in the specified security group |
Example
Request sample
Https://ecs.aliyuncs.com/?Action=JoinSecurityGroup
&instanceid= I-instance1
&securitygroupid=f876ff7ba984
&< Public Request Parameters >
Return sample
XML format
473469c7-aa6f-4dc5-b3db-a3dc0de3c83e
JSON format
{
"RequestID": "473469c7-aa6f-4dc5-b3db-a3dc0de3c83e"
}