Elastic Load Balancing
Developer Guide (API Version 2012-06-01)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.Did this page help you?  Yes | No |  Tell us about it...

Disable an Availability Zone from a Load-Balanced Application

In this example, you disable the Availability Zone us-east-1a for your EC2 application.

This scenario assumes that you have an HTTP load balancer enabled in Availability Zones us-east-1a and us-east-1b.

You disable the Availability Zone for the load balancer first, then give the instances time to go into the OutOfService state before deregistering them from your load balancer.

Note

Your load balancer always distributes traffic to all the enabled Availability Zones. If there are no healthy instances in an enabled Availability Zone, the request will be forwarded to healthy instances in another enabled Availability Zone. If you do not plan to have instances in a zone, you must disable it by calling the DisableAvailabilityZonesForLoadBalancer action on that Availability Zone.

Using Query API

To disable an availability zone from a Load Balanced Application

  1. Call DisableAvailabilityZonesForLoadBalancer with the following parameters:

    • LoadBalancerName = MyLoadBalancer

    • Availability Zones = us-east-1a

    The operation returns the updated list of Availability Zones enabled for your load balancer.

  2. Call DescribeInstanceHealth with the following parameters. You have to wait until all of the instances in the disabled Availability Zones are in the OutOfService state.

    • LoadBalancerName = MyLoadBalancer

    • Instances = i-4f8cf126, i-0bb7ca62

  3. Call DeregisterInstances with the following parameters:

    • LoadBalancerName = MyLoadBalancer

    • Instances = i-4f8cf126, i-0bb7ca62

Using the Command Line Interface

To disable an availability zone from a Load Balanced Application

  1. Use the elb-disable-zones-for-lb command as in the following example.

    PROMPT> elb-disable-zones-for-lb  MyLoadBalancer  --headers --availability-zones us-east-1a

    Elastic Load Balancing returns the following:

    AVAILABILITY_ZONES  AVAILABILITY-ZONES
    AVAILABILITY_ZONES  us-east-1b
  2. Use the elb-describe-instance-health command as in the following example.

    PROMPT> elb-describe-instance-health  MyLoadBalancer  --headers --instances i-4f8cf126,i-0bb7ca62	

    Elastic Load Balancing returns the following:

    INSTANCE  INSTANCE-ID STATE
    INSTANCE i-4f8cf126 OutOfService
    INSTANCE i-0bb7ca62 OutOfService	
  3. Use the elb-deregister-instances-from-lb command as in the following example.

    PROMPT> elb-deregister-instances-from-lb  MyLoadBalancer  --headers --instances i-4f8cf126,i-0bb7ca62

    Elastic Load Balancing returns the following:

    INSTANCE  INSTANCE-ID
    INSTANCE i-3a8cf324
    INSTANCE i-2603ca33