Created
October 22, 2014 01:11
-
-
Save ralph-tice/a4cd886a6704ac3351d1 to your computer and use it in GitHub Desktop.
Open an iTerm to every instance in an AutoScaling Group using aws-cli, knife and jq
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
launch_terms () { | |
until [ -z "$1" ] # Until uses up arguments passed... | |
do | |
/usr/bin/osascript <<-EOF | |
tell application "iTerm" | |
make new terminal | |
tell the current terminal | |
activate current session | |
launch session "Default Session" | |
tell the last session | |
write text "sshto \"$1\"" | |
end tell | |
end tell | |
end tell | |
EOF | |
shift | |
done | |
} | |
launch () { | |
launch_terms `aws autoscaling describe-auto-scaling-groups --auto-scaling-group-names $1 --output json | jq '.AutoScalingGroups[0].Instances | .[].InstanceId' -r` | |
} | |
sshto() { | |
ssh ubuntu@`knife ec2 server list | grep $1 | awk '{print $3}'` | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment