3

I'm starting to learn how to manage a cloud infrastructure and I'm going through the AWS documentation right now. If my question didn't make it obvious enough, I'm a complete beginner about this stuff. When creating a ELB (Elastic Load balancer), I get the option of selecting which availability zones I want my load balancers to serve.

My question is: Why would I not always select all of them? Seems like the worst case scenario is that the load balancers serve zones with no instances, which as far as I know is not a problem. Also, since I'll be using Spot Fleet with multiple zones to launch my instances, I won't know in which zones the instances are going to be launched, so I might as well select them all.

Am I wrong? Thank you.

  • I'm guessing that cost might be a factor. When you add an availability zone doesn't ELB create a load balancer node in that zone? If so, do you pay for those nodes? – joeqwerty Jun 18 '20 at 17:04
  • I didn't find anything in https://aws.amazon.com/elasticloadbalancing/pricing/ and from my understanding you don't need multiple nodes to serve multiple zone, it's actually just one node that redirect to other zones, no? Maybe I misunderstand how load balancers work. – MyUsername112358 Jun 18 '20 at 17:11
  • I've seen reports of additional latency in ELBs with an empty AZ, on the scale of several hundred additional milliseconds. – ceejayoz Jun 18 '20 at 17:16
  • I would think that ELB would need to spin up a node in the other zones, right? – joeqwerty Jun 18 '20 at 17:24
  • I guess it depends on the implementation, I don't think it necessarily does, it could just as easily send request directly to each instances, no? – MyUsername112358 Jun 18 '20 at 17:33

1 Answers1

3

Having ELB in a different AZ than the instance has two downsides:

  1. Slightly higher latency
  2. Cross-AZ traffic (which costs $0.02/GB)

ELB/ALB gives you the option to Enable / Disable Cross-AZ access. For small deployments you should keep it enabled so that the ELB can talk to any available host in any AZ (especially if you've got only one) to improve the availability.

On the other hand when you've got a large enough fleet of worker nodes across multiple AZs you should disable cross-az access in ELB to save on cross-az data transfer costs and to improve the latency.

With the above in mind you can now decide whether to create your ELB in all AZs or not.

Hope that explains it :)

MLu
  • 24,849
  • 5
  • 59
  • 86
  • Thank you! Your answer allowed me to find the relevant documentation that I couldn't find before, it complements your answer well for those who still have questions about the inner working of ELB: https://docs.aws.amazon.com/elasticloadbalancing/latest/userguide/how-elastic-load-balancing-works.html#cross-zone-load-balancing – MyUsername112358 Jun 19 '20 at 02:29