Let's imagine I'll be moving a domain (static.stuff.com) to cloudfront. I want to make sure that cloudfront is configured correctly before moving the dns for everyone. You can glue together a simple test with a couple commands locally
- locate the cloudfront.net domain for your distribution under the AWS cloudfront general tab
nslookup xxxxxxxxx.cloudfront.net
- Pick any of the ip addresses that domain resolves to (there will be several), lets assume
10.10.10.10
was one - Edit your
/etc/hosts
file and add a new line like :10.10.10.10 static.stuff.com
- Curl a file that cloudfront should find
curl -k -v https://static.stuff.com/some_file.txt
- Check for
x-amz-cf-id
in the response indicating cloudfront is in use.
Since I came here through Google, here's a 'one-liner':
curl -vvI -H "Host: thehosttoresolve.com" --resolve thehosttoresolve.com:443:12.12.12.12 https://thehosttoresolve.com/
change
thehosttoresolve.com
to the domain/host you want to hit (2 places!) and12.12.12.12
to the cloudfront IP.