Adds an instance to a specified security group. When you call this interface, consider the following:
Before joining a security group, the instance must be in the
Each instance can join a maximum of five security groups.
Each security group can manage up to 1000 instances.
Your instance and security group must be in the same Alibaba Cloud region.
The network type of your instance and security group must be the same. And if their network type is Virtual Private Cloud (VPC), the security group and the instance must belong to the same VPC. Otherwise, an error
|Action||String||Yes||The name of this interface. Value: JoinSecurityGroup.|
|InstanceId||String||Yes||The instance ID. You can call DescribeInstances to obtain all your instance IDs.|
|SecurityGroupId||String||Yes||The security group ID. You can call DescribeSecurityGroups to obtain all your security group IDs.|
All parameters are common response parameters. For more information, see Common parameters.
&<Common Request Parameters>
|Error code||Error message||HTTP status code||Meaning|
|InvalidInstanceId.Mismatch||Specified instance and security group are not in the same VPC.||400||The security group and the instance must belong to the same VPC.|
|InstanceSecurityGroupLimitExceeded||Exceeding the allowed amount of security groups that an instance can be in.||400||An instance can join a maximum of 5 security groups.|
|MissingParameter||The input parameter “InstanceId” that is mandatory for processing this request is not supplied.||400||You must specify the |
|MissingParameter||The input parameter “SecurityGroupId” that is mandatory for processing this request is not supplied.||400|| You must specify the |
|IncorrectInstanceStatus||The current status of the resource does not support this operation.||403||Before joining a security group, the instance must be in the |
|InstanceLockedForSecurity||The specified operation is denied as your instance is locked for security reasons.||403||Your request is denied as the specified instance is locked for security reasons.|
|SecurityGroupInstanceLimitExceeded||The maximum number of instances in a security group is exceeded.||403||Each security group can manage up to 1000 instances.|
|InvalidInstanceId.AlreadyExists||The specified instance already exists in the specified security group.||403||The specified instance has joined the specified security group.|
|OperationDenied||The specified operation is denied as your instance is locked for security reasons.||403||Your request is denied as the specified instance is locked for security reasons.|
|InvalidInstanceId.NotFound||The specified InstanceId does not exist.||404||The specified |
|InvalidSecurityGroupId.NotFound||The specified SecurityGroupId does not exist.||404|| The specified |