Skip to content

Instantly share code, notes, and snippets.

@jsgoecke
Created January 20, 2016 19:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsgoecke/b2fd21105277441663fc to your computer and use it in GitHub Desktop.
Save jsgoecke/b2fd21105277441663fc to your computer and use it in GitHub Desktop.
#!/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