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 you have created a security group. For more information, 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.
-
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
alb:LoadBalancerJoinSecurityGroup |
none |
*LoadBalancer
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| SecurityGroupIds |
array |
Yes |
The security group IDs. |
|
|
string |
No |
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 used to ensure the idempotence of the request. You can use the client to generate the token, but you must ensure that the token is unique across 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 elements
|
Element |
Type |
Description |
Example |
|
object |
The task result. |
||
| JobId |
string |
The ID of the asynchronous task. |
8fe81f25-79a0-4fa0-9036-f2601fda**** |
| RequestId |
string |
The request ID. |
D3B9AE45-F5DB-58E3-A4B5-EE58F1EC**** |
Examples
Success response
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. | |
| 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 a listener of the ALB instance is associated with an access control policy. The ALB instance cannot join a security group. |
| 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. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.