Published: December 16, 2021

How to SSH into an EC2 Instance Using PuTTY

If you're working with Amazon Web Services (AWS) and need to access your EC2 instances securely, PuTTY can be a valuable tool. However, PuTTY doesn't directly support the standard .pem files generated by AWS for SSH authentication. In this guide, I'll walk you through connecting to your EC2 instances using PuTTY by converting your .pem file to a .ppk file that PuTTY can understand.

Download PuTTY and PuTTYgen

To get started, you'll need to download PuTTYgen, a companion tool that converts the .pem file to a format accepted by PuTTY. This conversion is necessary because PuTTY doesn't directly accept .pem files generated by AWS.

Convert .pem to .ppk using PuTTYgen

Step 1: Launch PuTTYgen and load your .pem file generated by AWS.

PuTTYgen interface showing the process of converting a .pem file to .ppk format

Step 2: Once the file is loaded, click on Save private key to save the private key as a .ppk file. PuTTYgen will prompt you to save without a passphrase - you can proceed safely for this conversion.

Configure PuTTY Connection

Now that we have the converted .ppk file, let's configure PuTTY to SSH into our EC2 instance.

Step 1: Open PuTTY and enter the public IP address of your EC2 instance in the Host Name field.

PuTTY configuration window showing where to enter the EC2 instance IP address

Step 2: Navigate to Connection > Data in the left panel and specify the username as ec2-user (this may vary depending on your AMI - Ubuntu instances use ubuntu, Amazon Linux uses ec2-user).

PuTTY data configuration showing where to set the auto-login username

Step 3: Navigate to Connection > SSH > Auth > Credentials and browse to select your previously converted .ppk file.

PuTTY SSH authentication settings showing where to load the private key file

Step 4: Return to the Session category, optionally save your configuration for future use, then click Open to establish the connection to your EC2 instance.

Troubleshooting Common Issues

If you encounter connection issues, verify that:

  • Your EC2 instance's security group allows SSH traffic (port 22) from your IP address
  • The instance is in a running state
  • You're using the correct username for your AMI type
  • The .ppk file was properly converted from the original .pem file

This method provides a secure way to access your AWS EC2 instances using PuTTY's familiar interface, making server management more accessible for Windows users who prefer GUI-based SSH clients.