AWS IP Range Automation

Jan 30, 2020 Gethugothemes

AWS provides a list of their IP ranges for you to use when configuring whitelists, firewalls, and other things. The list is available in JSON from:

https://ip-ranges.amazonaws.com/ip-ranges.json

To get it automated into your pipelines, or scripts, you can use curl and jq in this manner:

curl https://ip-ranges.amazonaws.com/ip-ranges.json | jq .

This will give you all the IP’s, regions, and info.

To get more specific like the us-east-1 region and the AMAZON service, just add some more filters:

curl https://ip-ranges.amazonaws.com/ip-ranges.json | jq '.prefixes[] | select(.region == "us-east-1") | select(.service == "AMAZON")'

Similar Posts

OpenBSD PF and OpenDNS

At home, I needed a way to prevent anything but OpenDNS from being used for DNS, and needed a rule that would do it in OpenBSD PF. Install and Configure First off, to setup an OpenDNS client on OpenBSD, install the ddclient package via pkg_add ddclient