Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ssh aws instances by name tag
# ssh aws instances by name tag
# jq required - http://stedolan.github.io/jq/
#
# Usage:
# $ aws-ssh <ssh_user_name> <instance_name>
#
function aws-ssh(){
ssh $1@$(aws ec2 describe-instances --filters "Name=tag-key,Values=Name" "Name=tag-value,Values=$2" --output json | jq -r .Reservations[0].Instances[0].PublicIpAddress)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.