Connecting to AWS EC2 Instance Using Putty from Windows
In this article, we will see how to connect to the EC2 instance using puTTy.
PuTTY is a client program for the SSH, Telnet, and Rlogin network protocols. These protocols are all used to run a remote session on a computer, over a network. PuTTY implements the client end of that session: the end at which the session is displayed, rather than the end at which it runs.
In really simple terms: you run PuTTY on a Windows machine and tell it to connect to (for example) a Unix machine. PuTTY opens a window. Then, anything you type into that window is sent straight to the Unix machine, and everything the Unix machine sends back is displayed in the window. So you can work on the Unix machine as if you were sitting at its console, while actually sitting somewhere else.
Step 1: Download and Install puTTY
Download putty, from the putty download page https://www.chiark.greenend.org.uk/~sgtatham/putty/
Step 2: Download Key Pair
Download a key pair, it consists of a public key that AWS stores and a private key file that you store (downloaded as PEM file). PEM stands for Privacy Enhanced Mail and is a widely used X.509 encoding format used for security certificates. Together, the two keys enable you to securely connect to your EC2 instance using SSH. Below you can find a reference image
Step 3: Convert your pem file to ppk file
puTTy does not understand the PEMformat that AWS uses, so you need to convert it into the PPK file (ppk=putty private key). To do this we use puTTYgen utility.
Open puTTYgen utility, press the Load button and then select the .pem file which you have previously downloaded from AWS.
Note: when browsing for your PEM file be sure to select All Files in the dropdown list that is located to the right of the File name field. PuTTYgen will then load and convert your file.
Step 4: Launch putty to connect to EC2 instance
Before launching puTTY we have to know some parameter values like hostname, username, etc.
To know these parameters, one way is to go to the EC2 dashboard and click on the instance which chooses to connect, and then press the connect button present at top of the page.
After clicking the connect button you will get a dialog box like:
In my case:
Hostname is: ec2–15–206–167–138.ap-south-1.compute.amazonaws.com
Username: ubuntu
Now open puTTY and enter the following parameters into the respective fields. In the session area, you have to enter your hostname
In the data area you have to enter the username
Lastly in the SSH->AUTH load the converted PEMfile(PPK file) and then press open
Congrats, you have connected to EC2 instance if you see the below page