-
-
Save jsgoecke/b2fd21105277441663fc 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 | |
# This keeps the security group "route_53_health_check" updated | |
for h in `aws route53 get-checker-ip-ranges | jq -r '.CheckerIpRanges[]'`; do | |
printf "Adding ${h}" | |
aws ec2 authorize-security-group-ingress --group-id sg-8a9e81ef --protocol tcp --port 5060 --cidr $h > /dev/null 2>&1 | |
EXIT_CODE=$? | |
if [[ $EXIT_CODE -eq 0 ]]; then | |
echo " - Added" | |
elif [[ $EXIT_CODE -eq 255 ]]; then | |
echo " - Already present" | |
else | |
echo "Error" | |
echo "---> $EXIT_CODE" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment