1

We're in the process of migrating some sites over to AWS from another provider. Our current load balancer was available at a single IP so all the DNS entries were created with A records like:

A example.com 192.0.2.0

As you might know, AWS Elastic Load Balancer already provides an A Record for their Load Balancer so the sites are created with CNAME records like:

CNAME example.com production-lb1-<numbers>.us-west-1.elb.amazonaws.com

We set that record with a TTL of 900 Seconds we haven't seen it propagate out with

dig all example.com

Are there some magic DNS internals that stop name collisions like this? I.E. it doesn't want to create the CNAME because the A and CNAME would be pointing at contradictory information?

So does that mean I have to remove the A record and then add the CNAME? Are DNS controllers smart enough to not drop my site with nothing pointing at it? I.E. I would really not want the A name to go away when the CNAME isn't up yet. Thoughts?

5
  1. What's the TTL of the old A record? If it's for example 43200 (12 hrs) the old record will remain the the DNS caches worldwide for up to 12 hours.

    The solution to this is to drop the TTL on the old records to something like 300 (5 mins) well in advance before changing the records.

  2. You can't have CNAME in the domain root (aka apex). I.e. example.com A 123.456.789.123 is valid, while example.com CNAME production-lb1-...elb.amazonaws.com is not valid. That's probably why your DNS server ignored that.

    The solution for this is to migrate the domain example.com to AWS Route53 and then use ALIAS A record instead of CNAME. That way requests for example.com return the actual IP addresses of the ELB instead of a CNAME of the ELB. It's a slight but vital difference.

    Unfortunately ALIAS only works when both the domain and the load balancer are on AWS.

    See here: Why a domain’s root can’t be a CNAME

Hope that helps :)

  • Interesting information to chew on. I can't migrate to Route53 because they are for Random clients sites. TTL for CNAME was 900 seconds, TTL for A Name is 1800, but it's been an hour or so now. I also created a second CNAME for www.example.com so wouldn't the subdomain www have propograted out? – Aaron Chamberlain Mar 28 '19 at 1:43
  • Yes for www it should work with CNAME. Have all the authoritative nameservers picked up the new zone content? – MLu Mar 28 '19 at 1:45
  • So upon further reading CNAMES for the root/apex are not technically impossible, but not great solutions because they skip reading MX and TXT records. Do you happen to know if DNS Level URL Forwarding (301) also skips reading these records? Apparently some of my clients don't support modern record types like ALIAS or ANAME, so I'm looking for work arounds. – Aaron Chamberlain Mar 28 '19 at 15:55
  • @Aaron there is no such thing as DNS Level URL Forwarding (301). Either it’s HTTP Level 301 Redirect or it’s DNS CNAME / ALIAS / A. What you probably mean is the URL forwarding service that some DNS registrars offer - that may help although that’s got its own set of problems (eg using iframes or not preserving the website url). – MLu Mar 28 '19 at 18:45

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.