Skip to content

Instantly share code, notes, and snippets.

@grrrlikestaquitos
Created October 2, 2017 18:25
Show Gist options
  • Save grrrlikestaquitos/b871cd96c3ecb21795ab4895a855ae7e to your computer and use it in GitHub Desktop.
Save grrrlikestaquitos/b871cd96c3ecb21795ab4895a855ae7e to your computer and use it in GitHub Desktop.
Connect to AWS EC2 Instance Quicker - Command Line
#!/bin/bash
alias aws=aws
# Root Command
function aws() {
if [[ $# -eq 0 ]]; then
echo "Incomplete: Please pass in a server to connect to"
else
connect $1
fi
}
# Connect to AWS EC2 Instance with provided key-pair, username and IP address OR IPv4 Address
function connect() {
ssh -i ~/.ssh/your-private-key.pem $1@example.us-east-2.compute.amazonaws.com
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment