Skip to content

Instantly share code, notes, and snippets.

@lueo
Created February 21, 2016 09:47
Show Gist options
  • Save lueo/ac32598a41f2f641b133 to your computer and use it in GitHub Desktop.
Save lueo/ac32598a41f2f641b133 to your computer and use it in GitHub Desktop.
Get aws ip ranges
#!/usr/bin/python
import requests
import json
r = requests.get('https://ip-ranges.amazonaws.com/ip-ranges.json')
j = r.json()
print j['createDate']
for c in j['prefixes']:
if c['region'] == "ap-northeast-1":
print '{0:<20} {1:<20}'.format(c['ip_prefix'],c['service'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment