Adds an Application Load Balancer (ALB) instance to a security group.
Operation description
-
By default, security groups are unavailable. To use security groups, contact your account manager.
-
Make sure that a security group is created. For more information about how to create security groups, see CreateSecurityGroup .
-
Each ALB instance can be added to at most four security groups.
-
To query the security groups of an ALB instance, call the GetLoadBalancerAttribute operation.
-
GetLoadBalancerAttribute is an asynchronous operation. After a request is sent, the system returns a request ID and runs the task in the background. You can call the ListAsynJobs operation to query the status of the task.
- If the task is in the Succeeded state, the ALB instance is added to the security group.
- If the task is in the Processing state, the ALB instance is being added to the security group. In this case, you can query the task but cannot perform other operations.
Debugging
Authorization information
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
SecurityGroupIds | array | Yes | The security group IDs. | |
string | Yes | The security group ID. | sg-m5e7xkprgt1pi1ik**** | |
LoadBalancerId | string | Yes | The ALB instance ID. | alb-h7kcw4g4nnvtqp**** |
DryRun | boolean | No | Specifies whether to perform only a dry run, without performing the actual request. Valid values:
| false |
ClientToken | string | No | The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters. Note
If you do not specify this parameter, the system automatically uses the request ID as the client token. The request ID may be different for each request.
| 123e4567-e89b-12d3-a456-426655440000 |
Response parameters
Examples
Sample success responses
JSON
format
{
"JobId": "8fe81f25-79a0-4fa0-9036-f2601fda****",
"RequestId": "D3B9AE45-F5DB-58E3-A4B5-EE58F1EC****"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | IncorrectStatus.LoadBalancer | The status of %s [%s] is incorrect. | The status of %s [%s] is incorrect. |
400 | ResourceAlreadyAssociated.SecurityGroup | The specified resource of %s is already associated. | - |
400 | ResourceQuotaExceeded.SecurityGroupNum | The quota of %s is exceeded for resource %s, usage %s/%s. | - |
400 | OperationDenied.SecurityGroupNotSupport | The operation is not allowed because of %s. | - |
400 | OperationDenied.LbAssociatedAclCanNotJoinSecurityGroup | The operation is not allowed because of loadBalancer associated acl can not join security group. | This operation is not allowed because the listener under the Server Load Balancer instance has been bound to an access control policy. You are not allowed to join the security group again. |
404 | ResourceNotFound.LoadBalancer | The specified resource %s is not found. | The specified resource %s is not found. |
404 | ResourceNotFound.SecurityGroup | The specified resource %s is not found. | - |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2024-06-18 | The Error code has changed | View Change Details |