Created
May 27, 2017 11:36
-
-
Save danneu/a974b35e00a6766feef7433d71b87195 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
# pip install --upgrade --user awscli | |
while IFS= read -r line; do | |
aws ec2 authorize-security-group-ingress \ | |
--group-id sg-fb153885 \ | |
--protocol tcp \ | |
--port 80 \ | |
--cidr "$line" | |
done < <(curl --silent https://www.cloudflare.com/ips-v4) | |
while IFS= read -r line; do | |
aws ec2 authorize-security-group-ingress \ | |
--group-id sg-fb153885 \ | |
--ip-permissions '[{"IpProtocol": "tcp", "FromPort": 80, "ToPort": 80, "Ipv6Ranges": [{"CidrIpv6": "'"$line"'"}]}]' | |
done < <(curl --silent https://www.cloudflare.com/ips-v6) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment