Skip to content

Instantly share code, notes, and snippets.

@wagner
Created October 11, 2016 00:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wagner/38754e5346f2b9ee69784e247f4ccdb3 to your computer and use it in GitHub Desktop.
Save wagner/38754e5346f2b9ee69784e247f4ccdb3 to your computer and use it in GitHub Desktop.
Bash shortcut to SSH into AWS OpsWorks instances by hostname
# Bash shortcut to SSH into AWS OpsWorks instances by hostname
# Add the following function to your /etc/profile or ~/.bash_profile
# Connect to your instance using:
# $ ssh-aws your-host-name
function ssh-aws() {
ssh $(aws ec2 describe-instances --region us-east-1 --filters Name=tag-value,Values=$1 --query='Reservations[0].Instances[0].PrivateIpAddress' | tr -d '"')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment