Let's assume I have a multi-tenant webserver that runs an application for 500+ domains. I have an AWS Loadbalancer url, my_application.elb.eu-west-1.amazonaws.com, which have A
and AAAA
records to the actual LB. Now I want to ensure that all the domains I have point to this LB. Then I would see three options:
- Read the
A
andAAAA
records from my LB, and copy them for each domain. - Make a
CNAME
record for each domain, to the LB url (suggested solution by AWS) - Register one custom domain, e.g. applicationdns.com, and create a
CNAME
record to the LB url for e.g. www.applicationdns.com. Then for each domain create aCNAME
record to this record (www.applicationdns.com).
Of course, option 1 is horribly inefficient so discarded right away.
Option 2 is the suggested approach, which works fine. However, if at any point I would need to migrate the Loadbalancer to a different URL, I would need to fix 500+ DNS records, possibly distributed over multiple providers, so it is hard to automate.
Option 3 would solve this problem, however it introduces a "chained CNAME
". From what I've seen (RFC 1034) this is technically valid, but not considered good practice.
What is the best way to approach this challenge? Is there another approach that might work?