RRSet of type CNAME with DNS name foo.com. is not permitted at apex in zone bar.com

As per RFC1912 section 2.4:

 A CNAME record is not allowed to coexist with any other data.  In
 other words, if suzy.podunk.xx is an alias for sue.podunk.xx, you
 can't also have an MX record for suzy.podunk.edu, or an A record, or
 even a TXT record.  Especially do not try to combine CNAMEs and NS 
 records like this!:

           podunk.xx.      IN      NS      ns1
                           IN      NS      ns2
                           IN      CNAME   mary
           mary            IN      A

The RFC makes perfect sense as the nameserver wouldn't know whether it needs to follow the CNAME or answer with the actual record the CNAME overlaps with. bar.com is a zone therefore it implicitly has an SOA record for the bar.com name. You can't have both a SOA record and a CNAME with the same name.

However, given that SOA records are generally used only for zone maintenance, these situations where you want to provide a CNAME at the zone's apex are quite common. Even though the RFC prohibits it, many engineers would like a behaviour such as: "follow the CNAME unless the query explicitly asks for the SOA record". That's why Route 53 provides alias records. These are a Route 53 specific feature which offer the exact functionality you require. Have a look at http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/CreatingAliasRRSets.html


  1. Create an S3 Bucket called bar.com. (The name must be the same as the domain you want to redirect from in order for this to work!)
  2. In the bar.com S3 Bucket go to Properties > Static Website Hosting, select Redirect all requests to another host name and enter foo.com in the text box.
  3. Back in Route 53, in your Hosted Zone for bar.com, click Create Record Set. Select A - IPv4 address for type. Click Yes for Alias. Click the text box for Alias Target. bar.com should be listed under -- S3 Website Endpoints --. Save the record. Wait a few minutes and you should have a redirect setup to redirect requests from bar.com to foo.com.

You can use this same method to redirect a naked domain to a subdomain (like www). I use this in cases where www.foo.com has to be a CNAME so I redirect from foo.com to www.foo.com with this same method. If foo.com is an A record, you can use this technique to redirect from www.foo.com to foo.com.

NOTE: this method will forward with the full path. i.e. http://bar.com/test will forward to http://foo.com/test.


On Route53, You need to create an A record NOT a CNAME record, and create an alias under that.

From @ewalshe's comment on Alexandru Cucu's answer, if you came here trying to setup API Gateway with a custom domain name and have a Cloudfront distribution url.