1

I'm setting up an Application Elastic Load Balancer, and I have it pointing to a few EC2 instances. I'm now trying to get my head around how to set up the DNS, given that my DNS is hosted externally from AWS.

I understand that I can use the cname for my domain, so I can set up DNS records for www.example.com, foo.example.com (and any other sub-domain.example.com) and point those to my ELB which something like elb-123456789.eu-west-1.elb.amazonaws.com. So this is all fine.

However, for the apex record (example.com) I cannot use cname, and I must use an A record. As far as I can see (and I could be wrong on this), I need to use Route 53:

  • Create a hosted zone for example.com
  • Create a recordset inside that hosted zone for example.com, with a type of alias. For the alias target, I select the ELB from above
  • Click Save
  • ???

I have no idea how to now point my A record at my domain registrar to this Route 53 alias.

Or am I meant to be doing something completely different?

  • How stuck are you on the current DNS provider? You could run a little microservice that just redirects non-www to www, I suppose. – ceejayoz Feb 19 '18 at 21:25
4

DNS standards say you can't have a CNAME at the domain Apex, you need an A record.

Some providers will let you do this against standards. CloudFlare does this in a tricky way, it appears to let you create a CNAME at the domain apex but does it in a way that's standards compliant using a proxy system - Michael explains it well below.

The best option is to use AWS Route53 and alias records. Route53 takes over the job of providing DNS for the domain, you no longer need your previous DNS provider.

| improve this answer | |
  • I understand that, but as I outlined above, I have no idea how to point my A record to Route 53? Doesn't an A record have to point to an IP address? In which case, what IP address am I pointing to? Note that my domain is hosted at a different registrar – JonoB Feb 19 '18 at 21:49
  • 1
    You don't point an A record at Route 53. You'd use the Route 53 nameservers. This would affect the entire domain. – ceejayoz Feb 19 '18 at 21:49
  • What ceejayoz said. Answer updated. – Tim Feb 19 '18 at 21:53
  • So I have to migrate the nameservers to Route 53 as per docs.aws.amazon.com/Route53/latest/DeveloperGuide/… ? – JonoB Feb 19 '18 at 22:00
  • 2
    Note that Cloudflare's implementation does not violate the standard, because the answer isn't returned as a CNAME. They proxy a query out the back door for the real A/AAAA record, and return whatever value is found in the response they receive. support.cloudflare.com/hc/en-us/articles/… – Michael - sqlbot Feb 20 '18 at 0:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.