AWS Load Balancers – Why Use Host Names Instead of IP Addresses?

amazon-web-servicesclouddomain-name-systemgoogle-cloud-platformload balancing

I'm getting to know how load balancers work in cloud platforms. I'm specifically talking about load balancers you use to expose multiple backends to the public internet here, not internal load balancers.

I started with GCP, where when you provision a load balancer, you get a single public IP address. Then I learned about AWS, where when you provision a load balancer (or at least, the Elastic Load Balancer), you get a host name (like my-loadbalancer-1234567890.us-west-2.elb.amazonaws.com).

With the single IP, I can set up any DNS records I like. This means I can keep my name servers outside of the cloud platform to set up domains, and I can do DNS challenges for Lets Encrypt because I can set a TXT record for my domain after setting an A record for it. With the host name approach, I have to use ALIAS records (AWS has to track things internally) so I have to use their DNS service (Route 53). This DNS difference is a slight inconvenience for me, because it's not what I'm used to, and if I want to keep my main name servers for my domain outside of AWS, I can. I would just delegate a subdomain of my domain to Route 53's name servers.

So far, this DNS difference is the only consequence of this load balancer architectural difference that I've noticed. Maybe there are more. Is there a reason GCP and AWS may have chosen the approaches they did, from an architecture perspective? Pros and cons?

Best Answer

In AWS the Load Balancer IPs may change and the change is automatically reflected in the DNS name. Hence you refer to the DNS name (e.g. as a CNAME) and it all works. When using Route53 for DNS you can even create ALIAS-A records which directly propagates the current IP addresses from the LB DNS to your custom DNS name.

If you want the same behaviour as in GCP, i.e. a Load Balancer with two fixed, non-changing IP addresses look up Amazon Global Accelerator. It seamlessly integrates with AWS Application Load Balancer and gives you the same experience as you're used to on GCP.

Hope that helps :)