Question

I've set up a distribution but I'm a bit confused about the purpose of the CNAME that can be set up in Cloudfront. Assuming my assigned Cloudfront domain is d27fwrff25jcfdafa.cloudfront.net I can assign the "nice" CNAME static.example.com using the AWS Management Console.

I don't understand why I'd want to do this though. Why wouldn't I just create the CNAME in my sites DNS records and point it directly at d27fwrff25jcfdafa.cloudfront.net instead of creating the CNAME in Cloudfront? This is what I've done and it works perfectly but I don't like not understanding stuff.

Alternatively if I only created the CNAME using the Management Console wouldn't I then need to set my nameservers to Amazons so the CNAME can be resolved correctly? I can't find any mention of that step in the documentation so I guess I must be missing something!

Thanks for any help, Paul.

Was it helpful?

Solution

The process you describe in your second paragraph is exactly right. You create the CNAME record in your domain using your DNS provider. You then tell CloudFront about the CNAME so it knows to use your distribution when requests come in with your CNAME in the HTTP Host header.

Hope this helps!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top