4

Is it important to always have an ec2 instance in each zone of your load balancer? Are there advantages to having more than two or three zones?

We set up our application in an EC2 AutoScaling Group serving as the single Target Group of an Application Load Balancer. For our initial deployment, we set both the Launch Template and the Load Balancer to use six Availability zones. Based on the recommendation in paragraph 4 here, we set the AutoScaling Group's minimum size to six so there'd always be at least one box in each Zone.

In practice, most of the time we don't need six boxes; a minimum pool of two or three would give us the redundancy we need.

I can understand that without Cross-Zone Load Balancing it would be important to have a box in each zone, but Application Load Balancers always use Cross-Zone Load Balancing, so it seems like it shouldn't matter.
From the other angle, are there pros or cons to having our LB in so many zones?

1

As far as I know most regions you can only use 2 or 3 availability zones, only in us-east-1 region you can use up to 6 AZs. See AWS Global Infrastructure for details.

Word of mouth: I remember from some AWS presentation that even if they sometimes have more than 3 datacentres in some regions these are added to the existing 3 AZs because they realised that for most practical purposes 3 AZs are sufficient. [citation needed, I know. Sorry can't find a link]

Now to your question - when creating ALB you can select in which AZs you want it. If in us-east-1 you decide to stick to just 3 AZs your ALB can be set up only in these 3 AZs.

Select ALB AZs

If you've got instances in less AZs than ALB was enabled for don't worry, they will still route traffic to the existing instances in other zones. You may pay a little extra for cross-zone traffic but that will probably be less than the cost of running unneeded instances in each AZ. You do the maths.


And finally in my opinion using 3 AZs per region is more than enough, becasue:

  • The chances of an Availability Zone going down are small, but it happened couple of times in the past. If that happens you'll still have 2 other AZs online to pick up the load.

  • Whole region outages are very unusual. But even if that happens - if the whole region goes down due to some human or technical error it wouldn't matter if you've had your instances on 1 or in 6 AZs. The whole thing is down anyway.

  • If your deployment is totally super critical and you can't tolerate any downtime at all - deploy to multiple regions for extra redundancy. And then again it doesn't matter if in each region you've got 2 or 3 or 6 AZs.

Hope that helps :)

0

Nope you don't need an instance in each region, the load balancer in each AZ will check if there is an instance in its zone and if not it will route traffic to some healthy instance in some other zone.

Cross-zone load balancing doesn't really apply in this case. It's only used if there are healthy instances in all ELB zones but you still want the ELB to randomly choose an instance to talk to, regardless of its AZ. By default it only talks to instances in its AZ if there are any. If there are none it still talks to any available instance regardless of Cross-zone load balancing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.