Elastic Load Balancing
Developer Guide (API Version 2011-11-15)
Print this pageEmail this pageGo to the ForumsView the PDFShare this page on TwitterShare this page on FacebookBookmark this page on DeliciousSubmit this page to RedditSubmit this page to DiggDid this page help you?  Yes  No   Tell us about it...

Disabling 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]Note

Your load balancer always distributes traffic to all the enabled Availability Zones. If all the instances in an Availability Zone are deregistered or unhealthy before that Availability Zone is disabled for the load balancer, all requests sent to that Availability Zone may fail until DisableAvailabilityZonesForLoadBalancer calls for 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