Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Test Cloudfront node performance

Find an IP for a local Cloudfront node.

$ dig example.com

Use a DNS server in the country you are targeting to get an IP for a Cloudfront node there. Eg, for Australia, you can check this list: https://public-dns.info/nameserver/au.html

$ dig example.com @168.1.79.229

Use a combination of:

  • the --resolve flag in curl, to force CURL to resolve a domain to a given IP
  • curl "write out" variables to output some timing information on the connection.

Note that in the below example we are doing a standard GET and writing the data to /dev/null. We only see the headers (which show which Cloudfront node was used), and the timing information.

    curl -s -D - -o /dev/null
      https://www.example.com 
      -w "URL:\t%{url_effective}\nResponse code:\t%{response_code}\nDownload size:\t%{size_download}B\nDownload speed:\t%{speed_download}B/s\nTime connect:\t%{time_connect}s\nTime name lookup:\t%{time_namelookup}s\nTime pretransfer:\t%{time_pretransfer}\nTime start transfer:\t%{time_starttransfer}s\nTime redirect:\t%{time_redirect}s\nTime total:\t%{time_total}s\n"  
      --resolve www.example.com:443:13.224.180.83

With thanks to Geethika Guruge: https://ac3.co.nz/resources/amazon-cloudfront-launches-in-new-zealand

@cam8001

This comment has been minimized.

Copy link
Owner Author

@cam8001 cam8001 commented Apr 8, 2021

#!/usr/bin/env bash
# call as script.sh example.com ip-address
    curl -s -D - -o /dev/null https://$1 -w "URL:\t%{url_effective}\nResponse code:\t%{response_code}\nDownload size:\t%{size_download}B\nDownload speed:\t%{speed_download}B/s\nTime connect:\t%{time_connect}s\nTime name lookup:\t%{time_namelookup}s\nTime pretransfer:\t%{time_pretransfer}\nTime start transfer:\t%{time_starttransfer}s\nTime redirect:\t%{time_redirect}s\nTime total:\t%{time_total}s\n"  --resolve $1:443:$2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment