Search code examples
amazon-web-servicesamazon-cloudfrontgodaddy-api

Configure AWS CloudFront to be accessible from GoDaddy domain


I have a domain name configured into GoDaddy domain provider. I created Angular application accessible using this cloudfront internal web address: xxxxxxxxx.cloudfront.net

The question is how to configure the domain to redirect properly web requests to this address hosted on AWS. I contacted the GoDaddy support and they gave these instructions:

In order to make changes we need the nameservers and the nameservers will be provided by the host that is aws
Once you have the nameservers, Please open the dns page
You will see 2 nameservers that are for godaddy
Click on change option and then select I will use my own nameservers and then update the nameservers that will be provided.

Where I can see what are the names servers used in AWS Cloudfront?


Solution

  • You need to setup the domain in Route53 first (eg example.com), as part of the setup you get 4 name server addresses. You change the name servers at GoDaddy to your AWS nameservers as their support describe, which authorises Route53 to host your DNS. From then on you manage your DNS from Route53, not GoDaddy (but GoDaddy are still your registrar).

    Once your nameservers point to route53 follow the docs on creating an alias in route53

    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.

    When you change the nameservers on GoDaddy any DNS you setup there will no longer be visible on the internet, only whats in Route53. Transfer any records you have created in GoDaddy to Route53 before changing your nameservers. Ignore any DNS records you didnt create.

    If theres a problem you can goto GoDaddy and reset the nameservers back to default and that will restore the previous DNS.

    One thing to mention - TTL - time to live. If DNS records have a high TTL (in seconds) it means when you make changes it will take upto that amount of time for everyone to get the update. The TTL will be visible in GoDaddy, or you can search "DNS dig" to find online tools that read DNS. The TTL of the NS records might be high (days, a week etc) - this will effect how long it takes Route53 to fully take over responsibility of your DNS.