Skip to content

Instantly share code, notes, and snippets.

@iturgeon
Created January 30, 2018 18:33
Show Gist options
  • Save iturgeon/c2dac5cf9b9026aaf27b97bd6281bbbd to your computer and use it in GitHub Desktop.
Save iturgeon/c2dac5cf9b9026aaf27b97bd6281bbbd to your computer and use it in GitHub Desktop.
Testing Cloudfront settings before changing dns

Need to test an aws cloudfront distribution before you change the DNS?

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

  1. locate the cloudfront.net domain for your distribution under the AWS cloudfront general tab
  2. nslookup xxxxxxxxx.cloudfront.net
  3. Pick any of the ip addresses that domain resolves to (there will be several), lets assume 10.10.10.10 was one
  4. Edit your /etc/hosts file and add a new line like : 10.10.10.10 static.stuff.com
  5. Curl a file that cloudfront should find curl -k -v https://static.stuff.com/some_file.txt
  6. Check for x-amz-cf-id in the response indicating cloudfront is in use.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment