Page MenuHomePhabricator
Paste P10016

vcl_aws_nets.py
ActivePublic

Authored by ema on Dec 30 2019, 8:59 AM.
Tags
None
Referenced Files
F31494499: raw.txt
Dec 30 2019, 9:10 AM
F31494491: raw.txt
Dec 30 2019, 8:59 AM
Subscribers
None
#!/usr/bin/env python
import requests
ip_ranges = requests.get('https://ip-ranges.amazonaws.com/ip-ranges.json').json()['prefixes']
#amazon_nets = [item['ip_prefix'] for item in ip_ranges if item["service"] == "AMAZON"]
ec2_nets = [item['ip_prefix'] for item in ip_ranges if item["service"] == "EC2"]
print("acl aws_nets {")
for net in ec2_nets:
print('\t"{}";'.format(net))
print("}")

Event Timeline

ema changed the title of this paste from aws_ips.py to vcl_aws_nets.py.Dec 30 2019, 9:10 AM
ema edited the content of this paste. (Show Details)