Skip to content

Instantly share code, notes, and snippets.

@pahud
Created July 4, 2016 10:52
Show Gist options
  • Save pahud/224d2ff8139252a372a4c1282b90db73 to your computer and use it in GitHub Desktop.
Save pahud/224d2ff8139252a372a4c1282b90db73 to your computer and use it in GitHub Desktop.
generate AWS CloudFront IP/CIDR range
#!/usr/bin/env python
import requests, json
d = requests.get('https://ip-ranges.amazonaws.com/ip-ranges.json').text
l = json.loads(d)
for ip_range in [x['ip_prefix'] for x in l['prefixes'] if x['service']=='CLOUDFRONT' ]:
print ip_range
@pahud
Copy link
Author

pahud commented Jul 5, 2016

[HOWTO] Get real IP coming via AWS CloudFront and ELB to nginx — Medium - https://medium.com/@pahud/get-real-ip-coming-via-aws-cloudfront-and-elb-to-nginx-d418e5070976

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment