DNS – Point Apex Domain to AWS Load Balancer

amazon-web-servicesdomain-name-systemweb-hosting

I have an AWS Load Balancer that serves traffic to multiple EC2 instances serving multiple websites with different domain names.

I'm trying to find a simple solution where any domain owners can set their domain (for example mydomain.com) forward traffic to my load balancer which is going to serve their website.

There's a similar question here about not being able to alias the apex of a domain, and that makes sense. However, due to this limitation, scenarios like mine where I don't necessarily want to host the domain owner's entire record (via delegation) but only want to serve their root domain's web traffic becomes tricky.

While it is possible to set A records instead of alias to forward traffic directly to the IP addresses of the load balancer, AWS doesn't gurantee IP adresses will stay static and also if the load balancer is recreated, the IP addresses will change making it a less desirable solution.

Any ideas on how I could serve a root domain's websites through Load Balancer would be great.

Additionally, the domain owners' don't necessarily host their domains in Route53.

Best Answer

It depends on the DNS provider if they can provide a workaround for this issue. For example, Cloudflare provides CNAME flattening, where Cloudflare internally resolves the apex CNAME entries to IP addresses.

There is no generic solution that would apply to all DNS providers.

Related Topic