Last active
March 11, 2025 09:44
-
-
Save palmerj/e293b443def642431f05775aa4d7f640 to your computer and use it in GitHub Desktop.
One liner to get AWS S3 IP address ranges for ap-southeast-2 (Sydney)
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
curl https://ip-ranges.amazonaws.com/ip-ranges.json | jq '.prefixes' | jq 'map(select(.region=="ap-southeast-2"))' | jq 'map(select(.service=="S3"))' | jq 'map(.ip_prefix)' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Suggestion here @palmerj - piping to
jq
invokes jq multiple times within the shell, you can actually pipe to jq within a single jq process. In addition to that, you can combine multiple pipes with an expanded conditional statement.The final
.[]
will return the list directly.When using with
time cat local-ip-ranges.json
on a fetched file, with multiple| jq 'expr'
format:when piping within a single JQ process with pipes:
p.s. thanks for the gist, i was battling to the get the extractor working, helped a lot.