Last active
June 10, 2016 16:32
-
-
Save jeffdevine/25c1fff3431dc8d3902065f34eeccf38 to your computer and use it in GitHub Desktop.
ec2ssh
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
if [ $# -eq 0 ] ; then | |
environment="staging" | |
else | |
environment=$1 | |
fi | |
output="$(cap $environment ec2:status | grep 10.)" | |
ip="$(echo $output | awk '{print $6}' )" | |
name="$(echo $output | awk '{print tolower($3)}' )" | |
if [ ! -f "$HOME/.ssh/${name}-$environment.pem" ]; then | |
cap $environment deploy:download_ec2_key | |
fi | |
ssh -i $HOME/.ssh/${name}-$environment.pem deploy@${ip} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment