Avoiding downtime while switching CNAMEs with AWS’s Route53

a-recordamazon-route53amazon-web-servicescname-recorddomain-name-system

I'm trying to make a seamless transition from Heroku to AWS. Currently, DNS is being handled by Route53, with a CNAME record sending traffic to the heroku SSL subdomain. I need to change this to an A Alias record, pointing to the new Elastic Load Balancer with no service disruption.

If the initial record were an A record, then it would simply be a matter of creating the Alias A record, and then removing the original, so that there would always be an active A record for the given subdomain at all times. However, CNAMEs prevent any other records from being created for the same subdomain, with the following message:

<Error><Type>Sender</Type>
<Code>InvalidChangeBatch</Code>
<Message>RRSet of type A with DNS name www.example.com. is not permitted because a conflicting RRSet of type  CNAME with the same DNS name already exists in zone example.com.</Message></Error>

If I remove the CNAME record before creating the A record, then there will be a window during which expired TTLs will fail to resolve the site. How can I avoid this downtime?

Best Answer

It appears you're using the ChangeResourceRecordSets API call. Just send both changes at the same time: a CREATE for the A record and a DELETE for the CNAME record.

If this doesn't work, yell at Amazon until they fix it.

Related Topic