Created
March 3, 2015 17:04
-
-
Save nickrw/d3df63661e9fe7f9d8dd to your computer and use it in GitHub Desktop.
ssh-ec2 - designed as an alias replacement of ssh. Will try and convert tags or instance IDs to IPs, and opens sessions in tmux if more than one result is returned
This file contains hidden or 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 | |
try_ec2="$(resolve-ec2 $@)" | |
if [[ -z $try_ec2 ]]; then | |
ssh $@ | |
else | |
if [[ $(echo "$try_ec2" | wc -l ) -gt 1 ]]; then | |
mux $1 $try_ec2 | |
else | |
ssh $try_ec2 | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
!/bin/bash
try_ec2="$(resolve-ec2 $@)"
if [[ -z $try_ec2 ]]; then
ssh $@
else
if [[ $(echo "$try_ec2" | wc -l ) -gt 1 ]]; then
mux $1 $try_ec2
else
ssh $try_ec2
fi
fi