20

I am looking at moving our application up to Amazon Web Services. The plan is to have all of the EC2 instances mirrored across two availability zones. Due to data transfer costs, we will be staying in a single AWS region (Oregon).

The multiple AZs get rid of the single point of failure for our application and database servers, but what about the ELB? If I have a single ELB distributing traffic across two AZs, is the ELB also hosted across those two AZs?

What does Amazon do to prevent the ELB from being a SPoF?

Chris.B
  • 351
  • 1
  • 3
  • 7

3 Answers3

18

At its heart, an ELB is just a collection of EC2 instances. When you create an ELB, you specify the availability zones you want that load balancer to be in. Instances to make up the load balancer will then be created in those zones. The way they avoid a single point of failure here is by returning multiple IP addresses when you do a DNS lookup. For example:

  • DNS lookup for website.example.com returns CNAME website-elb-12345.eu-west-1.elb.amazonaws.com
  • The lookup also returns the information for website-elb-12345.eu-west-1.elb.amazonaws.com. It states that the site has IP address 1.2.3.4 and IP address 2.3.4.5

It is up to the client to choose which IP address to use to make a connection. The IP addresses won't always be returned in the same order from the DNS lookup. A client could retry on an alternative IP address if they can't connect on the first attempt.

The TTL on the DNS records for an ELB is only 60 seconds which means that should an ELB instance die and get replaced, the DNS will be updated everywhere fairly quickly.

Richard
  • 826
  • 2
  • 8
  • 20
  • So then, since I'll be deploying my application EC2 instances across multiple zones, when I create the ELB for that region, will it be automatically hosted on EC2 instances spread across those same two zones? – Chris.B Jul 14 '14 at 18:01
  • When you create the ELB, whether through the API or the console, you will be asked to select the availability zones that you want the ELB to operate in. You just need to select the same availability zones that your instances will be in. – Richard Jul 15 '14 at 22:03
  • Does the DNS get updated if an AZ goes down? – rogerdpack Feb 09 '22 at 22:34
  • It should do, yes. Instances will get replaced for many reasons, including an AZ going down, and each time this happens DNS will get updated. – Richard Feb 10 '22 at 18:59
4

It actually could be a SPoF but I believe it would be a SPoF only within the same region.

That's why AWS is suggesting to use Route 53 health checking in order to detect and re-route traffic that would end up on a unhealthy ELB.

You can use Amazon Route 53 health checking and DNS failover features to enhance the availability of the applications running behind Elastic Load Balancers. Route 53 will fail away from a load balancer if there are no healthy EC2 instances registered with the load balancer or if the load balancer itself is unhealthy.

Source: http://aws.amazon.com/elasticloadbalancing/

Alex
  • 3,079
  • 20
  • 28
  • So is there a way to set up more than one ELB in a single region. Have one as a primary and one as a standby? Or is Route 53 capable of firing up a new ELB instance? – Chris.B Jun 27 '14 at 16:12
  • I don't think Route 53 can automaticly setup an ELB, you would have to look in the developpers guide. – Alex Jun 27 '14 at 17:26
1

You can get around your single AZ SPoF by creating an autoscaling group where if your single ELB does not meet X factor, whether it is by load, response time, etc., a new ELB is created. ELBs are essentially EC2 instances running proprietary AWS code.

jon deane
  • 11
  • 1