When I first discovered building servers in AWS, how-to tutorials started by saying, you needed SSH into the EC2 instance. The problem was, I had no idea what SSH was or how to use it properly.

Every tutorial I found assumed you already knew how to SSH into a Server. For some reason, that was the only issue I had with the entire process. So today, I will show you how to SSH into an AWS EC2 Instance.

Step 1.

This is assuming you have spun up a new server and downloaded the PEM key.

Step 2.

On a Mac, open Terminal. If you are unfamiliar using Terminal, ls (list computer files) and cd (command) will be your friend. You will want to use "cd .." to move up a folder, then "ls" to list what is in that folder. Keep doing that until you find the folder you are looking for with the PEM key. If you know where you want to go, use the direct approach: e.g., "cd ~/Documents"

Step 3.

Set the PEM key permissions, e.g.,

chmod 400 isaac.pem

explained

chmod 400 FILE-NAME.pem

Step 4.

In Terminal, enter the SSH key credentials, e.g.,

ssh -i isaac.pem [email protected]

explained

ssh -i PEM-KEY-NAME.pem [email protected]

Extras

If you are unsure what your user name is (and it's not listed):

Amazon Linux or Red Hat Linux EC2 instance: ec2-user
Red Hat Linux or SUSE Linux EC2 instance: root
Ubuntu EC2 instance: ubuntu
Fedora Linux EC2 instance: fedora

If you need to use a specific port, add -P into the SSH string:

ssh -p 9222 -i isaac.pem [email protected]

When you have spaces in files, add quotation marks to avoid the spaces breaking the string:

mv /home/movie/"Vacation (2015) [1080p].mp4" /home/admin/web/

I hope this helps and saves you hours of frustration.