Created
December 24, 2013 00:49
-
-
Save thomasbiddle/8107184 to your computer and use it in GitHub Desktop.
This will add your current IP address to the security group of choice. Assumes EC2 tools are on your PATH.
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 | |
# Initialize our own variables: | |
GROUP="default" | |
REGION="ap-northeast-1" | |
# Get our real public IP. | |
IP_ADDRESS=`curl ifconfig.me --silent` | |
while getopts "r:g:" opt; do | |
case "$opt" in | |
g) | |
GROUP=$OPTARG | |
;; | |
r) REGION=$OPTARG | |
;; | |
esac | |
done | |
echo "Adding access for ${IP_ADDRESS}/32 to all ports on ${GROUP}/${REGION}." | |
ec2-authorize ${GROUP} --region ${REGION} -s ${IP_ADDRESS}/32 -p -1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment