Search code examples
amazon-web-servicesdnsaliasamazon-cloudfrontamazon-lightsail

Using A record or CNAME for cloud front distribution


My setup: On AWS lightsail Wordpress Instance and lightsail DNS zone

I'm not using Route53. Lightsail DNS zone does not support Alias or ANAM record. I have set up A record for example.com and CNAME for www.example.com pointing to example.com. I have force redirect http to https

I'm still trying to figure out how the distribution work. How can I best set up the distribution for custom domain name without Alias or ANAM record?

Referring to the screenshot from AWS, If I were to set up A record for example.com to point to default domain werhjk3yfhdsfljdsf.cloudfront.net, will there be any downtime if I were to reset cache, disable distribution or change distribution origin?

If I were to set up an A record or CNAME record for www.example.com to point to werhjk3yfhdsfljdsf.cloudfront.net, do I have to disable force redirect for distribution and google analytics to work?

enter image description here


Solution

  • If your DNS provider does not support Alias/ANAME records then you cannot use CloudFront for your root/ape record (example.com).

    You can however use it for any subdomain (e.g. www.example.com), this is done by creating the record itself as a CNAME.

    A key difference between A records and CNAME records is that an A record accepts an IPv4 address as the value for its record, whereas CNAME (or canonical name) accepts a domain as its value.

    If you disable the distribution, yes there would be downtime as you're disabling it. Other changes are gracefully rolled out to the edge locations so you might experience different behaviour where you are in the world.