Skip to content

Instantly share code, notes, and snippets.

@saidie
Created March 7, 2016 02:42
Show Gist options
  • Save saidie/729f59e56b39e4700725 to your computer and use it in GitHub Desktop.
Save saidie/729f59e56b39e4700725 to your computer and use it in GitHub Desktop.
lsips () {
aws ec2 describe-instances $@ --query "Reservations[].Instances[].PrivateIpAddress"
}
lsfilters () {
lsips --filters $@
}
lstag () {
lsfilters "Name=tag-key,Values=$1" "Name=tag-value,Values=$2"
}
lsname () {
lstag Name $1
}
lsrole () {
lstag Role $1
}
lsid () {
lsips --instance-ids $@
}
sshrole () {
ip=`lsrole $@ | jq -r ".[]" | perl -e 'srand; rand($.) < 1 && ($line = $_) while <>; print $line;'`
ssh $ip
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment