summaryrefslogtreecommitdiff
path: root/get-regions
blob: bb3fd744b44569ea0ae5ae653ae9434eb93353fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/bash
filter_output () {
	# drop any lines that doesn't contain a dash
	# (to filter out "GLOBAL")
	while read l
	do
		if [[ "$l" == *"-"* ]]; then
			echo $l
		fi
	done
}

set -o pipefail
curl -sSL 'https://ip-ranges.amazonaws.com/ip-ranges.json' |
	jq -r '.prefixes[].region, .ipv6_prefixes[].region' |
	sort |
	uniq |
	filter_output