Search code examples
amazon-web-servicesdnsamazon-cloudfront

How can I set the root domain as CNAME record with cloudfront?


I would like to point my root domain (abc.example) into cloudfront CNAME record (xxx.cloudfront.net). However, CNAME with @ as Host is not allowed at GoDaddy.

godaddy Setting

I wish https://abc.example is able to point to xxx.cloudfront.net.

How can I make the change?


Solution

  • You can redirect your own custom domain name to Amazon CloudFront but you will need to use Amazon Route 53 instead of a third-party DNS service.

    From Routing Traffic to an Amazon CloudFront Web Distribution by Using Your Domain Name - Amazon Route 53:

    If you want to use your own domain name, use Amazon Route 53 to create an alias record that points to your CloudFront distribution. An alias record is a Route 53 extension to DNS. It's similar to a CNAME record, but you can create an alias record both for the root domain, such as example.com, and for subdomains, such as www.example.com. (You can create CNAME records only for subdomains.) When Route 53 receives a DNS query that matches the name and type of an alias record, Route 53 responds with the domain name that is associated with your distribution.

    The steps are:

    • Use an A Record in Amazon Route 53
    • Set Alias = Yes
    • Set the Alias Target to the CloudFront distribution

    Please note that additional steps are required if you wish to use HTTPS (SSL) for the distribution. Using SNI is free, but dedicated IP addresses are expensive. See: Custom SSL | Content Delivery Network (CDN), Domain Registration | Amazon CloudFront