Skip to content

Instantly share code, notes, and snippets.

@joswr1ght
Created February 16, 2021 18:57
Show Gist options
  • Save joswr1ght/55ef4c90ea7f964b043b75ac55c224bc to your computer and use it in GitHub Desktop.
Save joswr1ght/55ef4c90ea7f964b043b75ac55c224bc to your computer and use it in GitHub Desktop.
Get AWS IP Addresses for a Specified Area
wget -qO- https://ip-ranges.amazonaws.com/ip-ranges.json | jq '.prefixes[] | if .region == "us-east-1" then .ip_prefix else empty end' -r | head -3
@i-am-offensive
Copy link

#!/bin/bash
REGION=$1
if [[ "${REGION}" == "" ]]; then
echo "Usage: $0 "
exit 1
fi
wget -qO- https://ip-ranges.amazonaws.com/ip-ranges.json | jq --arg region ${REGION} '.prefixes[] | if .region == $region then .ip_prefix else empty end' -r

@joswr1ght
Copy link
Author

#!/bin/bash
REGION=$1
...

Nicely done. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment