-
-
Save sidcpatel/d0cdd06bc82b80c0bf81f5787a24ed65 to your computer and use it in GitHub Desktop.
generate AWS CloudFront IP/CIDR range
This file contains 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
#!/usr/bin/env python | |
import requests, json, datetime | |
d = requests.get('https://ip-ranges.amazonaws.com/ip-ranges.json').text | |
l = json.loads(d) | |
print "# Amazon CloudFront IP Ranges" | |
print "# Generated at " + str(datetime.datetime.now()) | |
for ip_range in [x['ip_prefix'] for x in l['prefixes'] if x['service']=='CLOUDFRONT' ]: | |
print "set_real_ip_from " + ip_range + ";" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment