This post will show you step by step how to SSH into an EC2 instance from Windows using Putty.
What is SSH?
“SSH, also known as Secure Socket Shell, is a network protocol that provides administrators with a secure way to access a remote computer. SSH also refers to the suite of utilities that implement the protocol. Secure Shell provides strong authentication and secure encrypted data communications between two computers connecting over an insecure network such as the Internet. SSH is widely used by network administrators for managing systems and applications remotely, allowing them to log in to another computer over a network, execute commands and move files from one computer to another.” – Searchsecurity.techtarget.com
How to lunch an EC2 Instance?
How to SSH into an EC2 instance in Windows?
This tutorial presumes that you already have your private key (.pem) downloaded locally. If you don’t, have a look at the “HOW TO: Launch an EC2 instance in AWS“.
Download and install Putty
You can download Putty from here. Install it on your machine and move on to the next step.
Open PuttyGen

Click Load.

As highlighted, select all file types and locate your .pem key. Click Open and then OK on the pop-up window.

Click Save private key, the button highlighted in yellow in the picture above. Click Yes in the next pop-up window that will show up.

Save the .ppk file into a folder. You will be using this to SSH into your instance.
Open Putty

Copy Public DNS (IPv4) from AWS -> EC2

Log in to AWS. Go to EC2. Copy Public DNS (IPv4) link.
Add hostname in Putty

Your hostname will be composed of ec2-user@Public DNS (IPv4) link. Follow the next step before clicking Open.

Select SSH from the left menu, then click on Auth. You should get to the page opened on the image above. Once you’re there, click Browse and select your .ppk private key. Once you selected the file, click Open. You should now see a terminal opening, similar to the one from the picture below:

That’s it. You have successfully SSH into an EC2 instance. If you have just launched this instance, this proves that it works perfectly fine. You can now start configuring your server.
As always, let me know in the comments if you encounter any errors or you need any further help.
hi,
tried to connect the Windows EC2 instance using Putty and referring the steps above.
generated the private key by associating the .pem file and tried launch EC2 instance from putty using the dns name
getting “Fatal error – Network error : connection timeout”.
however is able to connect through RDP using the .pem private file. please help me to know how to resolve and connect the EC2 instance through SSH