Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
# ssh into an EC2 instance given it's AWS instance ID
# Usage: awsSsh [InstanceId] [Profile]
function awsSsh() {
ssh $(aws ec2 describe-instances --profile "${2:-default}" --region us-west-2 --output json --instance-ids "$1" | jq -j '.Reservations[0].Instances[0].PrivateIpAddress')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment