Connect to AWS EC2 instance using SSH

In this tutorial you will learn how to connect to the AWS EC2 instance using a SSH client like Putty.


1. AWS EC2 instance is running. (Follow here).

2. Putty is installed in your local machine. (Download Link)

3. Convert your private key using PuTTYgen .

PuTTY does not natively support the private key format for SSH keys. PuTTY provides a tool named PuTTYgen, which converts keys to the required format for PuTTY. You must convert your private key (.pem file) into this format (.ppk file)  in order to connect to your instance using PuTTY.

To convert your EC2 private key follow the below steps:

1. Launch PuTTYgen .

2. Under Type of key to generate, choose RSA.

3. Choose Load. By default, PuTTYgen displays only files with the extension .ppk. To locate your .pem file, choose the option to display files of all types.

4. Select your .pem file for the key pair that you specified when you launched your instance and choose Open. PuTTYgen displays a notice that the .pem file was successfully imported. Choose OK.

5. To save the key in the format that PuTTY can use, choose Save private key. PuTTYgen displays a warning about saving the key without a passphrase. Choose Yes.

6. Specify the same name for the key that you used for the key pair (for example, aws-demo-key) and choose Save. PuTTY automatically adds the .ppk file extension.

To connect to your EC2 instance, follow the below steps:

1. Launch Putty.

2. In the Category pane, choose Session and complete the following fields:

– In the Host Name box, enter ec2-user@Public IP or ec2-user@Public DNS(Copy it from EC2 Description).

– Ensure that the Port value is 22.

– Under Connection type, select SSH.

3. In the Category pane, expand Connection, expand SSH, and then choose Auth. Complete the following:

– Choose Browse.

– Select the .ppk file that you generated for your key pair and choose Open.

– Choose Open.

4. If this is the first time you have connected to this instance, PuTTY displays a security alert dialog box that asks whether you trust the host to which you are connecting. Choose Yes.

5. SSH connection to your EC2 instance is established successfully.

Note: If you face any connection issue then check if you have all the required inbound rules defined in your security group.


Bijan Patel

Founder & Creator of QAScript | 12+ years of IT Experience | Full Stack Automation Engineer | Blogger | Trainer

You may also like...

Leave a Reply

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

error: Content is protected !!