Created
November 16, 2017 18:03
-
-
Save drbh/45772264edd81ff654f4197718f8baca to your computer and use it in GitHub Desktop.
A CLI app that makes it easy to SSH into a EC2 instance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Ask the user for their name | |
echo 'Hello, I will help you connect to your EC2 instance. | |
You will need 3 pieces of information: | |
Username | |
Host Address | |
Path to key file\n\n' | |
read -n 1 -s -r -p "[Press any key to continue]" | |
echo '\n\n' | |
echo 'Username (OS specific. eg Ubuntu:ubuntu AmazonLinux:ec2-user)' | |
read username | |
echo 'Host-name (address eg. ec2-35-182-252-128.ca-central-1.compute.amazonaws.com)' | |
read host | |
echo 'Key Location (path eg. ~/Keys/your-key.pem)' | |
read key | |
chmod 400 $key | |
ssh -i $key $username@$host |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment