Skip to content

Instantly share code, notes, and snippets.

@Tiduster
Last active September 30, 2022 16:32
Show Gist options
  • Save Tiduster/783eb9363ba6a91a9b95a0b92ed7e58d to your computer and use it in GitHub Desktop.
Save Tiduster/783eb9363ba6a91a9b95a0b92ed7e58d to your computer and use it in GitHub Desktop.
Latency Test AWS Singapore
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
REGION_ARRAY=('ap-southeast-1')
SERVICE_ARRAY=('ecr' 's3' 'dynamodb')
PROBE_COUNT=300
for region in "${REGION_ARRAY[@]}"; do
for service in "${SERVICE_ARRAY[@]}"; do
ping_avg_rtt=$(ping -4 -c $PROBE_COUNT -q ${service}.${region}.amazonaws.com | grep rtt | awk -F '/' '{print $5}')
nping_avg_rtt=$(nping -q --tcp -p 443 -c $PROBE_COUNT ${service}.${region}.amazonaws.com | grep rtt | awk -F ' ' '{print $NF}')
echo "$region $service $ping_avg_rtt $nping_avg_rtt"
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment