Created
October 2, 2025 17:53
-
-
Save siddolo/536f71c01211c65f7ce9438c46bb57ca to your computer and use it in GitHub Desktop.
Obtain sorted list of AWS IPs, in CIDR notation, per specific regions and specific services (e.g., EC2, which also includes LAMBDA)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
AWS_REGION=eu-west-1 | |
AWS_SERVICE=EC2 | |
curl -s https://ip-ranges.amazonaws.com/ip-ranges.json | \ | |
jq '.prefixes[] | select(.region=="'${AWS_REGION}'" and .service=="'${AWS_SERVICE}'")' | \ | |
jq -r '.ip_prefix' | sort -V -t '/' -k 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment