Menu
Elastic Load Balancing
Developer Guide

Configure Cross-Zone Load Balancing for Your Load Balancer

By default, your load balancer distributes incoming requests evenly across its enabled Availability Zones. To ensure that your load balancer distributes incoming requests evenly across all back-end instances in its enabled Availability Zones, enable cross-zone load balancing. Cross-zone load balancing reduces the need to maintain equivalent numbers of back-end instances in each enabled Availability Zone, and improves your application's ability to handle the loss of one or more back-end instances. However, we still recommend that you maintain approximately equivalent numbers of back-end instances in each enabled Availability Zone for higher fault tolerance.

Note

When you enable cross-zone load balancing, you are not charged for data transfer between the load balancer nodes and back-end instances.

For environments where clients cache DNS lookups, incoming requests might favor one of the Availability Zones. Using cross-zone load balancing, this imbalance in the request load is spread across all available back-end instances in the region, reducing the impact of misbehaving clients.

Enable Cross-Zone Load Balancing

You can enable cross-zone load balancing for your load balancer at any time.

To enable cross-zone load balancing using the console

  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. On the navigation pane, under LOAD BALANCING, choose Load Balancers.

  3. Select your load balancer.

  4. In the bottom pane, click (Edit) in the Cross-Zone Load Balancing: Disabled row.

  5. In the Configure Cross-Zone Load Balancing dialog box, select Enable.

  6. Click Save.

To enable cross-zone load balancing, set the CrossZoneLoadBalancing attribute of your load balancer to true.

To enable cross-zone load balancing using the AWS CLI

  1. Use the following modify-load-balancer-attributes command:

    aws elb modify-load-balancer-attributes --load-balancer-name my-loadbalancer --load-balancer-attributes "{\"CrossZoneLoadBalancing\":{\"Enabled\":true}}"

    The following is an example response:

    {
       "LoadBalancerAttributes": {
         "CrossZoneLoadBalancing": {
             "Enabled": true
           }
       },
       "LoadBalancerName": "my-loadbalancer"
     }
    
  2. (Optional) Use the following describe-load-balancer-attributes command to verify that cross-zone load balancing is enabled for your load balancer:

    aws elb describe-load-balancer-attributes --load-balancer-name my-loadbalancer

    The following is an example response:

    {
        "LoadBalancerAttributes": {
            "ConnectionDraining": {
                "Enabled": false, 
                "Timeout": 300
            }, 
            "CrossZoneLoadBalancing": {
                "Enabled": true
            }, 
            "ConnectionSettings": {
                "IdleTimeout": 60
            }, 
            "AccessLog": {
                "Enabled": false
            }
        }
    }

Disable Cross-Zone Load Balancing

You can disable the cross-zone load balancing option for your load balancer at any time.

To disable cross-zone load balancing using the console

  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. On the navigation pane, under LOAD BALANCING, choose Load Balancers.

  3. Select your load balancer.

  4. In the bottom pane, click (Edit) in the Cross-Zone Load Balancing: Enabled row.

  5. In the Configure Cross-Zone Load Balancing dialog box, select Disable.

  6. Click Save.

To disable cross-zone load balancing, set the CrossZoneLoadBalancing attribute of your load balancer to false.

To disable cross-zone load balancing using the AWS CLI

  1. Use the following modify-load-balancer-attributes command:

    aws elb modify-load-balancer-attributes --load-balancer-name my-loadbalancer --load-balancer-attributes "{\"CrossZoneLoadBalancing\":{\"Enabled\":false}}"

    The following is an example response:

    {
       "LoadBalancerAttributes": {
         "CrossZoneLoadBalancing": {
             "Enabled": false
           }
       },
       "LoadBalancerName": "my-loadbalancer"
     }
  2. (Optional) Use the following describe-load-balancer-attributes command to verify that cross-zone load balancing is disabled for your load balancer:

    aws elb describe-load-balancer-attributes --load-balancer-name my-loadbalancer

    The following is an example response:

    {
        "LoadBalancerAttributes": {
            "ConnectionDraining": {
                "Enabled": false, 
                "Timeout": 300
            }, 
            "CrossZoneLoadBalancing": {
                "Enabled": false
            }, 
            "ConnectionSettings": {
                "IdleTimeout": 60
            }, 
            "AccessLog": {
                "Enabled": false
            }
        }
    }