Created
August 28, 2016 06:44
-
-
Save ShawInnes/7b5789d22d1143958eca4d5ca741dd1d to your computer and use it in GitHub Desktop.
Python Script to Nicely format AWS IP Ranges
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
import requests | |
from prettytable import PrettyTable | |
url_ips = requests.get('https://ip-ranges.amazonaws.com/ip-ranges.json') | |
ip_range = url_ips.json() | |
table = PrettyTable(['service', 'region', 'ip_prefix']) | |
table.align = "l" | |
for prefix in ip_range['prefixes']: | |
table.add_row([prefix['service'], prefix['region'], prefix['ip_prefix']]) | |
print(table) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
requires PTable pip to be installed