CodeSteps

Python, C, C++, C#, PowerShell, Android, Visual C++, Java ...

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

Connecting 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 a 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 the user name & 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 the PuTTY Configuration window, click on “Session” from the left side list. PuTTY will display basic options for the session.

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

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

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

One thought on “AWS : Connect to Virtual Machine (EC2 Instance) using standalone SSH Client

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top
Exit mobile version