Menu
Elastic Load Balancing
API Reference (API Version 2012-06-01)

ModifyLoadBalancerAttributes

Modifies the attributes of the specified load balancer.

You can modify the load balancer attributes, such as AccessLogs, ConnectionDraining, and CrossZoneLoadBalancing by either enabling or disabling them. Or, you can modify the load balancer attribute ConnectionSettings by specifying an idle connection timeout value for your load balancer.

For more information, see the following in the Classic Load Balancer Guide:

Request Parameters

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

LoadBalancerAttributes

The attributes for the load balancer.

Type: LoadBalancerAttributes object

Required: Yes

LoadBalancerName

The name of the load balancer.

Type: String

Required: Yes

Response Elements

The following elements are returned by the service.

LoadBalancerAttributes

Information about the load balancer attributes.

Type: LoadBalancerAttributes object

LoadBalancerName

The name of the load balancer.

Type: String

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

LoadBalancerAttributeNotFound

The specified load balancer attribute does not exist.

HTTP Status Code: 400

LoadBalancerNotFound

The specified load balancer does not exist.

HTTP Status Code: 400

Examples

Enable Cross-Zone Load Balancing

This example modifies the CrossZoneLoadBalancing attribute of the specified load balancer.

Sample Request

https://elasticloadbalancing.amazonaws.com/?Action=ModifyLoadBalancerAttributes &LoadBalancerAttributes.CrossZoneLoadBalancing.Enabled=true &LoadBalancerName=my-loadbalancer &Version=2012-06-01 &AUTHPARAMS

Sample Response

<ModifyLoadBalancerAttributesResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/"> <ModifyLoadBalancerAttributesResult> <LoadBalancerName>my-loadbalancer</LoadBalancerName> <LoadBalancerAttributes> <CrossZoneLoadBalancing> <Enabled>true</Enabled> </CrossZoneLoadBalancing> </LoadBalancerAttributes> </ModifyLoadBalancerAttributesResult> <ResponseMetadata> <RequestId>83c88b9d-12b7-11e3-8b82-87b12EXAMPLE</RequestId> </ResponseMetadata> </ModifyLoadBalancerAttributesResponse>

Enable Access Logs

This example enables access logs for the specified load balancer.

Sample Request

https://elasticloadbalancing.amazonaws.com/?Action=ModifyLoadBalancerAttributes &LoadBalancerAttributes.AccessLog.Enabled=true &LoadBalancerAttributes.AccessLog.S3BucketName=my-loadbalancer-logs &LoadBalancerAttributes.AccessLog.S3BucketPrefix=my-bucket-prefix/prod &LoadBalancerAttributes.AccessLog.EmitInterval=60 &LoadBalancerName=my-loadbalancer &Version=2012-06-01 &AUTHPARAMS

Sample Response

<<ModifyLoadBalancerAttributesResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/"> <ModifyLoadBalancerAttributesResult> <LoadBalancerName>my-loadbalancer</LoadBalancerName> <LoadBalancerAttributes> <AccessLog> <Enabled>true</Enabled> <S3BucketName>my-loadbalancer-logs</S3BucketName> <S3BucketPrefix>my-bucket-prefix/prod</S3BucketPrefix> <EmitInterval>60</EmitInterval> </AccessLog> </LoadBalancerAttributes> </ModifyLoadBalancerAttributesResult> <ResponseMetadata> <RequestId>83c88b9d-12b7-11e3-8b82-87b12EXAMPLE</RequestId> </ResponseMetadata> </ModifyLoadBalancerAttributesResponse>

Enable Connection Draining

This example modifies the ConnectionDraining attribute of the specified load balancer.

Sample Request

https://elasticloadbalancing.amazonaws.com/?Action=ModifyLoadBalancerAttributes &LoadBalancerName=my-loadbalancer &LoadBalancerAttributes.ConnectionDraining.Enabled=true &LoadBalancerAttributes.ConnectionDraining.Timeout=60 &Version=2012-06-01 &AUTHPARAMS

Sample Response

<<ModifyLoadBalancerAttributesResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/"> <ModifyLoadBalancerAttributesResult> <LoadBalancerName>my-loadbalancer</LoadBalancerName> <LoadBalancerAttributes> <ConnectionDraining> <Enabled>true</Enabled> <Timeout>60</Timeout> </ConnectionDraining> </LoadBalancerAttributes> </ModifyLoadBalancerAttributesResult> <ResponseMetadata> <RequestId>83c88b9d-12b7-11e3-8b82-87b12EXAMPLE</RequestId> </ResponseMetadata> </ModifyLoadBalancerAttributesResponse>

Configure Idle Timeout

This example modifies the idle timeout value of the specified load balancer.

Sample Request

https://elasticloadbalancing.amazonaws.com/?Action=ModifyLoadBalancerAttributes &LoadBalancerAttributes.ConnectionSettings.IdleTimeout=30 &LoadBalancerName=my-loadbalancer &Version=2012-06-01 &AUTHPARAMS

Sample Response

<<ModifyLoadBalancerAttributesResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/"> <ModifyLoadBalancerAttributesResult> <LoadBalancerName>my-loadbalancer</LoadBalancerName> <LoadBalancerAttributes> <ConnectionSettings> <IdleTimeout>30</IdleTimeout> </ConnectionSettings> </LoadBalancerAttributes> </ModifyLoadBalancerAttributesResult> <ResponseMetadata> <RequestId>83c88b9d-12b7-11e3-8b82-87b12EXAMPLE</RequestId> </ResponseMetadata> </ModifyLoadBalancerAttributesResponse>

See Also

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