Created
September 22, 2012 04:05
-
-
Save michaelhood/3765076 to your computer and use it in GitHub Desktop.
EC2 SSH-by-Instance-ID
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
# ssh $(ec2ip i-a1b2c3d) | |
function ec2ip() { if [ "$#" -gt 0 ]; then ip=$(ec2din --show-empty-fields -H $1 | grep "^INST" | cut -f17); echo $ip; fi } | |
function ec2pip() { if [ "$#" -gt 0 ]; then ip=$(ec2din --show-empty-fields -H $1 | grep "^INST" | cut -f18); echo $ip; fi } | |
function ec2host() { if [ "$#" -gt 0 ]; then ip=$(ec2din --show-empty-fields -H $1 | grep "^INST" | cut -f4); echo $ip; fi } | |
# ec2ssh i-a1b2c3d | |
function ec2ssh() { if [ "$#" -gt 0 ]; then ip=$(ec2din --show-empty-fields -H $1 | grep "^INST" | cut -f4); echo $ip; ssh $ip; fi } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment