Is it possible to point a top level domain like http://example.com to a amazon cloudfront distribution?
I know it's possible with CNAME's but as far as i know i need to set a A-name record for the top level domain in the DNS settings.
As explained by @dgeske, this can be done.
In my case, I had not purchased the domain from Route 53
, and hence had to do extra configuration.
Scenario: You have the following
Your nomenclature is slightly inaccurate. example.com is not a TLD (top-level domain), it is what is called a second-level domain. See the following image.
Steps to do this.
Now you should be able to access your cloudfront distribution at http://example.com
.
Depending on your DNS server, it may take a while to get records updated.
You may configure your system to use a public DNS server such as 8.8.8.8
to verify if you are able to access the cloudfront distribution using the URL. I used firefox's DNS over https
feature for this. This makes firefox use cloudflare's (not cloudfront) DNS servers. You can also use dig command line utility dig @8.8.8.8 example.com
(My domain was fightcoronapune.com, hence, dig @8.8.8.8 fightcoronapune.com
) (telling dig to use 8.8.8.8 DNS server to resolve names)
You may additionally get Access Denied
error, in which case you will have to configure the default root object for your cloudfront distribution. So that when you visit http://example.com
the file http://example.com/index.html
is served to you (assuming you specified index.html as default root object). This error has nothing to do with the steps we did above, and you will still get this error even if you directly use your cloudfront distribution's URL given by Amazon (eg. when you go to http://abcd.cloudfront.net directly
, instead of going to http://example.com
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With