Elastic Load Balancing
API Reference (API Version 2015-12-01)


Associates the specified security groups with the specified Application Load Balancer. The specified security groups override the previously associated security groups.

Note that you can't specify a security group for a Network Load Balancer.

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.


The Amazon Resource Name (ARN) of the load balancer.

Type: String

Required: Yes


The IDs of the security groups.

Type: Array of strings

Required: Yes

Response Elements

The following element is returned by the service.


The IDs of the security groups associated with the load balancer.

Type: Array of strings


For information about the errors that are common to all actions, see Common Errors.


The requested configuration is not valid.

HTTP Status Code: 400


The specified security group does not exist.

HTTP Status Code: 400


The specified load balancer does not exist.

HTTP Status Code: 400


Associate a security group with a load balancer

This example associates the specified security group with the specified load balancer.

Sample Request &LoadBalancerArn=arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188 &SecurityGroups.member.1=sg-5943793c &Version=2015-12-01 &AUTHPARAMS

Sample Response

<SetSecurityGroupsResponse xmlns=""> <SetSecurityGroupsResult> <SecurityGroupIds> <member>sg-5943793c</member> </SecurityGroupIds> </SetSecurityGroupsResult> <ResponseMetadata> <RequestId>a127426b-f3ab-11e5-9192-3fff33344cfa</RequestId> </ResponseMetadata> </SetSecurityGroupsResponse>

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: