Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sashareds/12f3dbb3b6aaaeaeb95bfdcfc541dbeb to your computer and use it in GitHub Desktop.
Save sashareds/12f3dbb3b6aaaeaeb95bfdcfc541dbeb to your computer and use it in GitHub Desktop.
Ping all AWS EC2 IPs from http://ec2-reachability.amazonaws.com/
We can make this file beautiful and searchable if this error is corrected: It looks like row 183 should actually have 3 columns, instead of 4 in line 182.
Region,Prefix,IP
us-east-1,23.20.0.0/14,23.23.255.255
us-east-1,50.16.0.0/15,50.17.255.254
us-east-1,50.19.0.0/16,50.19.255.254
us-east-1,52.0.0.0/15,52.1.255.254
us-east-1,52.2.0.0/15,52.2.0.2
us-east-1,52.4.0.0/14,52.7.255.255
us-east-1,52.20.0.0/14,52.20.63.253
us-east-1,52.70.0.0/15,52.70.63.252
us-east-1,52.72.0.0/15,52.72.63.252
us-east-1,52.86.0.0/15,52.86.63.252
us-east-1,52.90.0.0/15,52.90.63.252
us-east-1,52.200.0.0/13,52.200.255.254
us-east-1,54.80.0.0/14,54.80.0.2
us-east-1,54.84.0.0/15,54.84.0.3
us-east-1,54.86.0.0/15,54.86.63.252
us-east-1,54.88.0.0/16,54.88.0.3
us-east-1,54.89.0.0/16,54.89.0.3
us-east-1,54.90.0.0/15,54.90.0.3
us-east-1,54.92.128.0/17,54.92.128.2
us-east-1,54.144.0.0/14,54.144.0.2
us-east-1,54.152.0.0/16,54.152.63.252
us-east-1,54.156.0.0/14,54.156.0.0
us-east-1,54.160.0.0/14,54.160.0.2
us-east-1,54.164.0.0/15,54.164.63.252
us-east-1,54.166.0.0/15,54.166.0.2
us-east-1,54.172.0.0/15,54.172.63.252
us-east-1,54.174.0.0/15,54.174.0.2
us-east-1,54.196.0.0/15,54.196.0.1
us-east-1,54.198.0.0/16,54.198.0.1
us-east-1,54.204.0.0/15,54.205.255.255
us-east-1,54.208.0.0/15,54.208.0.1
us-east-1,54.210.0.0/16,54.210.63.252
us-east-1,54.221.0.0/16,54.221.214.221
us-east-1,54.224.0.0/15,54.225.110.215
us-east-1,54.226.0.0/15,54.226.0.1
us-east-1,54.234.0.0/15,54.235.236.60
us-east-1,54.236.0.0/15,54.236.0.0
us-east-1,54.240.8.0/21,54.240.8.0
us-east-1,54.242.0.0/15,54.243.255.254
us-east-1,67.202.0.0/18,67.202.0.5
us-east-1,72.44.32.0/19,72.44.32.8
us-east-1,75.101.128.0/17,75.101.163.105
us-east-1,107.20.0.0/14,107.22.255.255
us-east-1,174.129.0.0/16,174.129.0.31
us-east-1,184.72.64.0/18,184.72.92.4
us-east-1,184.72.128.0/17,184.72.255.254
us-east-1,184.73.0.0/16,184.73.173.231
us-east-1,204.236.192.0/18,204.236.238.4
us-west-1,50.18.0.0/16,50.18.56.1
us-west-1,52.8.0.0/16,52.8.191.254
us-west-1,52.9.0.0/16,52.9.63.252
us-west-1,52.52.0.0/15,52.52.63.252
us-west-1,54.67.0.0/17,54.67.63.253
us-west-1,54.151.0.0/17,54.151.0.2
us-west-1,54.153.0.0/17,54.153.63.252
us-west-1,54.176.0.0/15,54.176.64.1
us-west-1,54.183.0.0/16,54.183.64.3
us-west-1,54.193.0.0/16,54.193.0.3
us-west-1,54.215.0.0/16,54.215.0.1
us-west-1,54.219.0.0/16,54.219.127.255
us-west-1,54.241.0.0/16,54.241.127.255
us-west-1,184.72.0.0/18,184.72.56.36
us-west-1,184.169.128.0/17,184.169.255.254
us-west-1,204.236.128.0/18,204.236.129.206
us-west-2,50.112.0.0/16,50.112.120.53
us-west-2,52.10.0.0/15,52.10.63.252
us-west-2,52.12.0.0/15,52.13.255.255
us-west-2,52.24.0.0/14,52.24.63.252
us-west-2,52.32.0.0/14,52.32.63.252
us-west-2,52.36.0.0/14,52.36.0.2
us-west-2,52.40.0.0/14,52.43.255.254
us-west-2,52.88.0.0/15,52.88.0.2
us-west-2,54.68.0.0/15,54.68.63.252
us-west-2,54.70.0.0/15,54.70.0.12
us-west-2,54.148.0.0/15,54.148.0.2
us-west-2,54.184.0.0/15,54.184.0.3
us-west-2,54.186.0.0/15,54.186.0.3
us-west-2,54.188.0.0/15,54.188.0.0
us-west-2,54.190.0.0/16,54.190.0.0
us-west-2,54.191.0.0/16,54.191.63.252
us-west-2,54.200.0.0/15,54.200.0.1
us-west-2,54.202.0.0/15,54.202.0.1
us-west-2,54.212.0.0/15,54.212.0.0
us-west-2,54.214.0.0/16,54.214.0.1
us-west-2,54.218.0.0/16,54.218.4.254
us-west-2,54.240.24.0/21,54.240.24.0
us-west-2,54.244.0.0/16,54.244.128.1
us-west-2,54.245.0.0/16,54.245.127.255
us-gov-west-1,52.222.0.0/17,52.222.9.163
eu-west-1,46.51.128.0/18,46.51.178.50
eu-west-1,46.137.0.0/17,46.137.120.1
eu-west-1,46.137.128.0/18,46.137.191.254
eu-west-1,52.16.0.0/15,52.16.0.2
eu-west-1,52.18.0.0/15,52.19.0.2
eu-west-1,52.30.0.0/15,52.30.63.252
eu-west-1,52.48.0.0/14,52.48.63.252
eu-west-1,52.208.0.0/13,52.215.255.254
eu-west-1,54.72.0.0/16,54.72.255.252
eu-west-1,54.73.0.0/16,54.73.0.1
eu-west-1,54.74.0.0/15,54.74.0.1
eu-west-1,54.76.0.0/15,54.76.0.3
eu-west-1,54.78.0.0/16,54.78.0.3
eu-west-1,54.154.0.0/16,54.154.63.252
eu-west-1,54.155.0.0/16,54.155.0.1
eu-west-1,54.170.0.0/16,54.170.248.3
eu-west-1,54.171.0.0/16,54.171.63.252
eu-west-1,54.194.0.0/15,54.194.255.254
eu-west-1,54.216.0.0/15,54.216.0.1
eu-west-1,54.220.0.0/16,54.220.0.0
eu-west-1,54.228.0.0/16,54.228.250.251
eu-west-1,54.229.0.0/16,54.229.0.1
eu-west-1,54.240.0.0/21,54.240.0.0
eu-west-1,54.246.0.0/16,54.246.127.255
eu-west-1,54.247.0.0/16,54.247.127.254
eu-west-1,79.125.0.0/17,79.125.120.9
eu-west-1,176.34.64.0/18,176.34.127.254
eu-west-1,176.34.128.0/17,176.34.255.255
eu-west-1,185.48.120.0/22,185.48.120.66
eu-central-1,52.28.0.0/16,52.28.63.252
eu-central-1,52.29.0.0/16,52.29.63.252
eu-central-1,52.58.0.0/15,52.58.63.252
eu-central-1,54.93.0.0/17,54.93.32.2
eu-central-1,54.93.128.0/17,54.93.162.162
ap-northeast-1,46.51.224.0/19,46.51.255.254
ap-northeast-1,52.68.0.0/15,52.68.63.252
ap-northeast-1,52.192.0.0/15,52.192.63.252
ap-northeast-1,52.196.0.0/14,52.196.63.252
ap-northeast-1,54.64.0.0/15,54.64.0.2
ap-northeast-1,54.92.0.0/17,54.92.0.2
ap-northeast-1,54.95.0.0/16,54.95.0.2
ap-northeast-1,54.150.0.0/16,54.150.0.255
ap-northeast-1,54.168.0.0/16,54.168.0.2
ap-northeast-1,54.178.0.0/16,54.178.0.2
ap-northeast-1,54.199.0.0/16,54.199.127.255
ap-northeast-1,54.238.0.0/16,54.238.0.0
ap-northeast-1,54.248.0.0/15,54.248.127.254
ap-northeast-1,54.250.0.0/16,54.250.128.0
ap-northeast-1,103.4.8.0/21,103.4.10.139
ap-northeast-1,175.41.192.0/18,175.41.248.202
ap-northeast-1,176.32.64.0/19,176.32.95.254
ap-northeast-1,176.34.0.0/18,176.34.56.254
ap-northeast-2,52.78.0.0/16,52.78.63.252
ap-northeast-2,52.79.0.0/16,52.79.52.64
ap-southeast-1,46.51.216.0/21,46.51.216.14
ap-southeast-1,46.137.192.0/18,46.137.255.254
ap-southeast-1,52.74.0.0/16,52.74.0.2
ap-southeast-1,52.76.0.0/17,52.76.0.2
ap-southeast-1,52.76.128.0/17,52.76.191.252
ap-southeast-1,52.77.0.0/16,52.77.63.252
ap-southeast-1,52.220.0.0/15,52.221.255.252
ap-southeast-1,54.151.128.0/17,54.151.128.2
ap-southeast-1,54.169.0.0/17,54.169.0.2
ap-southeast-1,54.169.128.0/17,54.169.191.253
ap-southeast-1,54.179.0.0/17,54.179.0.2
ap-southeast-1,54.179.128.0/17,54.179.191.252
ap-southeast-1,54.251.0.0/16,54.251.63.255
ap-southeast-1,54.254.0.0/16,54.254.128.1
ap-southeast-1,54.255.0.0/16,54.255.0.2
ap-southeast-1,122.248.192.0/18,122.248.255.254
ap-southeast-1,175.41.128.0/18,175.41.146.190
ap-southeast-2,52.62.0.0/15,52.62.63.252
ap-southeast-2,52.64.0.0/17,52.64.63.253
ap-southeast-2,52.64.128.0/17,52.64.191.252
ap-southeast-2,52.65.0.0/16,52.65.63.252
ap-southeast-2,54.66.0.0/17,54.66.0.2
ap-southeast-2,54.66.128.0/17,54.66.191.252
ap-southeast-2,54.79.0.0/16,54.79.127.252
ap-southeast-2,54.153.128.0/17,54.153.191.252
ap-southeast-2,54.206.0.0/17,54.206.127.254
ap-southeast-2,54.206.128.0/17,54.206.128.2
ap-southeast-2,54.252.0.0/16,54.252.88.8
ap-southeast-2,54.253.0.0/16,54.253.0.1
ap-south-1,52.66.0.0/16,52.66.66.2
sa-east-1,52.67.0.0/16,52.67.255.254
sa-east-1,54.94.0.0/17,54.94.0.66
sa-east-1,54.94.128.0/17,54.94.191.252
sa-east-1,54.207.0.0/16,54.207.127.254
sa-east-1,54.232.0.0/16,54.232.127.254
sa-east-1,54.233.64.0/18,54.233.127.252
sa-east-1,54.233.128.0/17,54.233.192.0
sa-east-1,54.240.16.0/21,54.240.16.0
sa-east-1,177.71.128.0/17,177.71.255.255,
#!/bin/bash
export IFS=","
echo "REGION,PREFIX,IP,RESULT"
cat hostlist.csv | while read Region Prefix IP
do
result=`ping "$IP" | tail -1| gawk '{print $9}' | cut -d '/' -f 2`
echo "$Region,$Prefix,$IP,$result"
done
read -p "Press enter to continue" nothing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment