Save your key pair downloaded from the EC2 accounts page for the server instance to your local machine.
Save the file in a readily accessible place on your disk. I like saving keys in a directory called keys
in my root.
PEMFILE=/path/to/pem/file.pem
mkdir -p /c/keys
mv $PEMFILE /c/keys
Because of an EC2 permissions policy, the key pair file needs to be OpenSSH standard (don't worry about this). What you do need to do, however, is limit the permission on the file to read-only. Use the chmod
program on a *NIX system shell for this. If you're using Windows, use Git Bash for Windows or WSL Ubuntu or openSUSE.
chmod 400 /c/keys/$PEMFILE
On my machine the command looks like this:
cd "C:\\keys"
chmod 400 redshift2gsheets.pem
Now it's time to log in to the EC2 server!
In this example we are going to use a server running some programs for Ruggable. Best practice is to create a different user for each... well, user. But! We're in a trusting mood, so the Ruggable techie is going to log in to the ubuntu
user on the EC2 instance.
On Windows you can use PuTTY. But don't. Everyone should be logging in from a Bash-like shell. The command line is your friend. You can later use the alias
command to log in using just a few keystrokes. On my machine, I set an alias where typing rvm
logs in to this Ruggable VM. Handy when you are working with multiple remote servers.
Log in using the ssh
program.
ssh -i /c/keys/redshift2gsheets.pem [email protected]
Accept the prompt by typing yes
... and you are in!
💾💾💾
Still need help? Contact me!