Finding the Closest AWS Region


A script to ping EC2 endpoints

Ever wonder which AWS region is right for you? There’s a lot to consider. You need to think about everything from:

  • Costs of services in the region
  • Availability of services in the region
  • Latency between the region and your customers

The first two bullets are easy to evaluate. Some services are not in every region, so you should make sure the services you need are in a region before you spin up resources. Some regions are more expensive, for example, us-west-1 is more expensive than any other region in the US.

If you find yourself having to choose between multiple regions because of cost and service parity, I wrote a script that should help with that.

Usage of the script is straightforward, as long as you have bash.

  1. Download the script somewhere
  2. Mark the script executable (chmod +x ping-aws.sh)
  3. Run the script!

You’ll get output like this:

$ ./ping-aws.sh
us-east-1:	49.943
us-east-2:	48.952
us-gov-west-1:	47.724
us-west-1:	37.220
us-west-2:	47.157
ap-northeast-1:	145.626
ap-northeast-2:	174.246
ap-south-1:	245.503
ap-southeast-1:	204.736
ap-southeast-2:	207.452
ca-central-1:	64.855
cn-north-1:	228.061
cn-northwest-1:	227.024
eu-central-1:	137.045
eu-west-1:	142.313
eu-west-2:	129.374
eu-west-3:	126.100
sa-east-1:	161.953

If you find a region is missing (I’m sure newer regions are missing), simply add it to the regions list in the script.

Please post in the comments if this script has helped you!

aws  script 

See also