Setting up CloudFront CDN on a cookieless root domain

amazon s3amazon-cloudfrontamazon-web-servicescdndomain-name-system

I have recently set up an AWS S3 bucket for my site's static content, along w/ a CloudFront distribution for my CDN. I have this working using a sub-domain.

However, after running YSlow, I realized that cookie data is still getting passed to my subdomain CDN (4 cookies), which I suspect are cookies from the Google Adsense ads on my root domain. So I'd like to set up another dedicated root domain for my CDN.

My question is, if this new root domain is dedicated to just my CDN, what should I set up as the IP address for the root A record? Obviously, the point of a CDN is to allow it to determine the ultimate destination IP based on location.

Or, does it not even matter what this IP is, as it will be driven by the CDN anyway?

Best Answer

First, you have control on the behavior of your CloudFront distribution regarding cookies. You can disable cookies forward altogether or whitelist the ones that you need.

For the DNS, you shouldn't provide an IP as the actual serving IP will be determine in run time for each user based on his location. You need to define the CNAME in your distribution settings: http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/CNAMEs.html

Note that the DNS protocol does not allow you to create a CNAME record for the top node of a DNS namespace, also known as the zone apex.