Score:0

point apex domain to aws load balancer

nf flag

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.

Score:1
us flag

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.

Patrick Mevzek avatar
cn flag
"There is no generic solution that would apply to all DNS providers." Not yet, but soon. The new SVCB/HTTPS records that are already used in the wild even if the specification is not yet a standard, completely allow to have the "CNAME at apex" feature, so in a standardized way.
us flag
True, but that requires support from applications, so it will take time before it is realistic for all the use cases.
Patrick Mevzek avatar
cn flag
Except that iOS (hence I guess Safari) is already consuming those records... As is Google Chrome, in an experiment that will convert to public use (https://bugs.chromium.org/p/chromium/issues/detail?id=1052476). See my longer answer at https://serverfault.com/a/1075524/396475 for more details (but already very much outdated as 6 months old)
us flag
My point is that even if support is available in recent browsers, you might still have visitors with older browsers where this does not help.
Arpan Adhikari avatar
nf flag
Amazing! CNAME flattening by Cloudflare looks like a promising solution. Hopefully more DNS providers will start introducing these features until the SVCB/HTTPS RRs become mainstream.
Score:0
nf flag

Answering my own question since it solved my problem and might be helpful for someone else in the future.

Turns out you can create AWS Load Balancer with pre-allocated IP addresses.

Here's the high level process:

  1. From EC2 console, allocate an Elastic IP Address.

allocate an EIP

  1. When you create a new network load balancer you will be able to select this IP as your LB's public IP for a Subnet. You can allocate multiple EIPs and assign them to each Subnet.

create a new NLB

This solved the problem for me because I no longer have to contact domain owners to keep updating their DNS records (I don't host their entire domain) and can also keep recreating the NLB and reassigning the same set of Public IPs to it.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.