Skip to content

Instantly share code, notes, and snippets.

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 rhoml/5662004 to your computer and use it in GitHub Desktop.
Save rhoml/5662004 to your computer and use it in GitHub Desktop.
Add this to your bash_profile of your OSX profile and enjoy.
publicdns() {
EC2_DESCRIBE_INSTANCES=`which ec2-describe-instances | awk '{print $3}'`
EC2_DESCRIBE_GROUP=`which ec2-describe-group | awk '{print $3}'`
SECURITY_GROUP="$1"
AWS_CERT=~/.ec2/cert.pem
AWS_PK=~/.ec2/pk.pem
echo "This are the Available servers on ${SECURITY_GROUP} security group."
${EC2_DESCRIBE_INSTANCES} -C ${AWS_CERT} -K ${AWS_PK} | grep INSTANCE | grep `${EC2_DESCRIBE_GROUP} -C ${AWS_CERT} -K ${AWS_PK} ${SECURITY_GROUP} | head -1 | awk '{print $2}'` | awk '{print $4 }'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment