AWS : Connect to Virtual Machine (EC2 Instance) using standalone SSH Client

Connect to EC2 Instance is the next step most of us do after launching the Virtual Machine (EC2 Instance) in AWS Management Console. I have explained how to create a Virtual Machine with EC2 using AWS Management Console in my previous Article “AWS : Creating a Virtual Machine with EC2“.

Through this Article, I would like to explain how to Connect to EC2 Instance using standalone SSH Client.

  • This was tested from Windows 7 OS.

Step 1. Lets’ first download the SSH client. I prefer, PuTTY. Download & install it on your System.

Step 2. Open the PuTTY, to connect to EC2 Instance.

Step 3. Usually to connect to the System, we need to provide user name & the password. First, we need to identify what is the user name & password we need to use. Below are the steps to identify these:

Step 3.1. User name is the one you can use depending on the AMI type you have selected while creating the EC2 Instance. AWS use the below default user names:

  • “ec2-user” for Amazon Linux
  • “centos” for CentOS
  • “admin” or “root” for Debian
  • “ec2-user” or “root” for Red Hat Enterprise Linux (RHEL) and SUSE
  • “ec2-user” or “fedora” for Fedora and
  • “ubuntu” for Ubuntu

We have used Amazon Linux AMI in our previous Article while creating the EC2 Instance; so, the default user name is “ec2-user”.

Step 3.2. Only user name is not enough to connect to the EC2 instance. We need IP Address or Public DNS of the EC2 instance. This we can find in EC2 instance page.

Step 3.3. Password is the “Key pair” file what we have downloaded while launching the EC2 instance, in our previous Article. This file contains the private key details. We need to use the file to connect to the EC2 instance. PuTTY can’t understand this file (*.pem file). PuTTY can read the private key details from “*.ppk” file(s), only.

So, how do we generate this “*.ppk” file from our “*.pem” file.? This article “PuTTY : Convert .pem file to .ppk file” will help to convert the “.pem” file “.ppk” file.

Step 4. Come back to PuTTY, In PuTTY Configuration window, click on “Session” from left side list. PuTTY will display basic options for the session.

Step 5. Enter “ec2-user@IP_Address_of_EC2_Instance” value in “Host Name (or IP address)” field. For example: if the host name is “xyz” you can enter ec2-user@xyz in the “Host Name (Or IP address)” field. If the IP address of EC2 instance is 1.2.3.4, you can enter ec2-user@1.2.3.4 in the “Host Name (Or IP address)” filed.



Step 6. Now we need to provide the private key file for the authentication. Select “Auth” from PuTTY configuration window; which is under SSH; which is under “Connection” category. Once you select “Auth” from the Category list, PuTTY will display the options controlling SSH authentication.

Step 7. Click on the Browse… button to select the private key file for authentication. We already have “.ppk” file from the above steps. Select the “.ppk” file to use for the authentication.

Step 8. Click on Open button to connect to EC2 Instance, what we have created from our previous Article. Once it is connected, the console window looks like below. From the shell, you can run commands on the EC2 Instance.

Connect to EC2 Instance
Connect to EC2 Instance

Step 9. Once you done with the work on EC2 Instance, type exit command at the shell prompt to disconnect from the Ec2 Instance.

[..] David

One Comment

Add a Comment

Your email address will not be published.