| « PreviousNext » | |
![]() ![]() ![]() | Did this page help you? Yes | No | Tell us about it... |
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.
To disable an availability zone from a Load Balanced Application
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.
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
Call DeregisterInstances with the following parameters:
LoadBalancerName = MyLoadBalancer
Instances = i-4f8cf126, i-0bb7ca62
To disable an availability zone from a Load Balanced Application
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
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
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