ApplySecurityGroupsToLoadBalancer - Elastic Load Balancing

ApplySecurityGroupsToLoadBalancer

Associates one or more security groups with your load balancer in a virtual private cloud (VPC). The specified security groups override the previously associated security groups.

For more information, see Security groups for your Classic Load Balancer in the User Guide for Classic Load Balancers.

Request Parameters

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

LoadBalancerName

The name of the load balancer.

Type: String

Required: Yes

SecurityGroups.member.N

The IDs of the security groups to associate with the load balancer. Note that you cannot specify the name of the security group.

Type: Array of strings

Required: Yes

Response Elements

The following element is returned by the service.

SecurityGroups.member.N

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

Type: Array of strings

Errors

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

InvalidConfigurationRequest

The requested configuration change is not valid.

HTTP Status Code: 409

InvalidSecurityGroup

One or more of the specified security groups do not exist.

HTTP Status Code: 400

LoadBalancerNotFound

The specified load balancer does not exist.

HTTP Status Code: 400

Examples

Associate a security group

This example associates a security group with the specified load balancer in a VPC.

Sample Request

https://elasticloadbalancing.amazonaws.com/?Action=ApplySecurityGroupsToLoadBalancer &LoadBalancerName=my-vpc-loadbalancer &SecurityGroups.member.1=sg-123456789 &Version=2012-06-01 &AUTHPARAMS

Sample Response

<ApplySecurityGroupsToLoadBalancerResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/"> <ApplySecurityGroupsToLoadBalancerResult> <SecurityGroups> <member>sg-123456789</member> </SecurityGroups> </ApplySecurityGroupsToLoadBalancerResult> <ResponseMetadata> <RequestId>06b5decc-102a-11e3-9ad6-bf3e4EXAMPLE</RequestId> </ResponseMetadata> </ApplySecurityGroupsToLoadBalancerResponse>

See Also

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