AWS EC2: Connect to Linux Instance using SSH

Michael Galarnyk
Dec 20, 2016 · 3 min read
Connect to Linux Instance using SSH Video
  1. Go to Amazon Web Services’ Website (Link)

2. Sign in if you have account, if not make one

3. Press EC2

4. Press Running Instances. If you don’t have a running instance, please see part 1 of the tutorial.

5. Select your instance and make sure your key (pem file) matches your key pair name

6. Use the chmod command (in bold below) to make sure your private key file isn’t publicly viewable. Please see commonly asked questions section below if you have issues and are using windows.

chmod 400 /path_to_key/my_key.pem

7. Finally, SSH to your EC2 instance (in bold below)

ssh -i /path_to_key/my_key.pem user_name@public_dns_name

  1. What if I don’t know my username?

Answer: Please use the appropriate UserName based on what type of Amazon Machine Image Type you selected in Part 1.

Usernames for Various Amazon Machine Images

2. If you get the following: “chmod is not recognized as an internal or external command”, you are probably using a Windows machine (it is not normally a windows command).

Potential Fix 1: Download and install Gnu on windows (GOW) from the following link. Basically, GOW allows you to use linux commands on windows (including chmod)

Linux Commands on Windows (GOW)

Potential Fix 2: If you want to Install Git on Windows, it gives you the option to add unix tools (chmod and ssh included).

Please let me know if you have any questions! I am happy to answer questions in the comments section below or on the youtube video page. The next tutorial is AWS EC2: Install Anaconda on Linux Instance.

Michael Galarnyk

Written by

Data Scientist at Scripps Research Institute