Skip to content

Instantly share code, notes, and snippets.

@cdimartino
Created June 25, 2013 21:17
Show Gist options
  • Save cdimartino/5862492 to your computer and use it in GitHub Desktop.
Save cdimartino/5862492 to your computer and use it in GitHub Desktop.
alias ec2="knife search node -a ec2.public_hostname "
alias ec2pri="knife search node -a hostname "
alias ec2ssh="knife ssh -a ec2.public_hostname "
function ec2er {
TERM=xterm ec2 "chef_environment:$1 AND role:$2*"
}
function ec2ids {
TERM=xterm knife search node -a ec2.id "$1"
}
function ec2screen {
TERM=xterm knife ssh -a ec2.public_hostname "$1" screen
}
function ec2tmux {
TERM=xterm knife ssh -a ec2.public_hostname "$1" tmux
}
function ec2prod {
TERM=xterm ec2er production $1
}
function ec2term {
for i in $*
do
knife node delete -y $i
knife client delete -y $i
ec2-terminate-instances $i
done
}
function emrpk {
scp -o StrictHostKeyChecking=no $(dirname ${EC2_PRIVATE_KEY})/emr_shared.pem hadoop@${1}:pk.pem
}
function emrssh {
ssh -L 9100:localhost:9100 -L 11000:localhost:11000 -o ServerAliveInterval=10 -o StrictHostKeyChecking=no -i ${EC2_PRIVATE_KEY} hadoop@${1}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment