There are more AWS SDK examples available in the AWS Doc SDK Examples
Use ModifyLoadBalancerAttributes with a CLI
The following code examples show how to use ModifyLoadBalancerAttributes.
- CLI
-
- AWS CLI
-
To modify the attributes of a load balancer
This example modifies the
CrossZoneLoadBalancingattribute of the specified load balancer.Command:
aws elb modify-load-balancer-attributes --load-balancer-namemy-load-balancer--load-balancer-attributes "{\"CrossZoneLoadBalancing\":{\"Enabled\":true}}"Output:
{ "LoadBalancerAttributes": { "CrossZoneLoadBalancing": { "Enabled": true } }, "LoadBalancerName": "my-load-balancer" }This example modifies the
ConnectionDrainingattribute of the specified load balancer.Command:
aws elb modify-load-balancer-attributes --load-balancer-namemy-load-balancer--load-balancer-attributes "{\"ConnectionDraining\":{\"Enabled\":true,\"Timeout\":300}}"Output:
{ "LoadBalancerAttributes": { "ConnectionDraining": { "Enabled": true, "Timeout": 300 } }, "LoadBalancerName": "my-load-balancer" }-
For API details, see ModifyLoadBalancerAttributes
in AWS CLI Command Reference.
-
- PowerShell
-
- Tools for PowerShell V4
-
Example 1: This example enables cross-zone load balancing for the specified load balancer.
Edit-ELBLoadBalancerAttribute -LoadBalancerName my-load-balancer -CrossZoneLoadBalancing_Enabled $trueExample 2: This example disables connection draining for the specified load balancer.
Edit-ELBLoadBalancerAttribute -LoadBalancerName my-load-balancer -ConnectionDraining_Enabled $falseExample 3: This example enables access logging for the specified load balancer.
Edit-ELBLoadBalancerAttribute -LoadBalancerName my-load-balancer ` >> -AccessLog_Enabled $true ` >> -AccessLog_S3BucketName amzn-s3-demo-logging-bucket ` >> -AccessLog_S3BucketPrefix my-app/prod ` >> -AccessLog_EmitInterval 60-
For API details, see ModifyLoadBalancerAttributes in AWS Tools for PowerShell Cmdlet Reference (V4).
-
- Tools for PowerShell V5
-
Example 1: This example enables cross-zone load balancing for the specified load balancer.
Edit-ELBLoadBalancerAttribute -LoadBalancerName my-load-balancer -CrossZoneLoadBalancing_Enabled $trueExample 2: This example disables connection draining for the specified load balancer.
Edit-ELBLoadBalancerAttribute -LoadBalancerName my-load-balancer -ConnectionDraining_Enabled $falseExample 3: This example enables access logging for the specified load balancer.
Edit-ELBLoadBalancerAttribute -LoadBalancerName my-load-balancer ` >> -AccessLog_Enabled $true ` >> -AccessLog_S3BucketName amzn-s3-demo-logging-bucket ` >> -AccessLog_S3BucketPrefix my-app/prod ` >> -AccessLog_EmitInterval 60-
For API details, see ModifyLoadBalancerAttributes in AWS Tools for PowerShell Cmdlet Reference (V5).
-