Skip to content

Instantly share code, notes, and snippets.

@adamenger
Created November 2, 2016 19:40
Show Gist options
  • Save adamenger/efe0d765d4808f43f71b5752eccbd389 to your computer and use it in GitHub Desktop.
Save adamenger/efe0d765d4808f43f71b5752eccbd389 to your computer and use it in GitHub Desktop.
find all ip blocks for a given region in aws
#!/bin/bash
function get_aws_ips() {
region=$1
curl -s https://ip-ranges.amazonaws.com/ip-ranges.json | jq ".prefixes[] | select(.region==\"$region\") | .ip_prefix" | tr -d '"'
}
if [ $# -eq 0 ]
then
echo "Usage: ./aws_ips.sh us-east-1"
exit 1
else
get_aws_ips $1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment