AWS EC2 Instance Connection

How to Connect to an Amazon EC2 Instance Using PuTTY via SSH

Connecting to an Amazon Web Services Amazon EC2 instance via SSH using PuTTY is a standard workflow for Windows users managing cloud infrastructure. This guide breaks down the entire process—from retrieving your instance IP address to configuring secure access using SSH keys and security groups.


What You Need Before You Start

Before initiating an SSH connection, ensure you have the following:

  • A running Amazon EC2 instance
  • Public IPv4 address of the instance
  • A .pem private key file (downloaded during instance creation)
  • PuTTY and PuTTYgen installed on your local machine

Download PuTTY here:
PuTTY Official Download Page


Step 1: Find Your EC2 Public IP Address

To connect to your instance, you first need its public IP:

  1. Log in to AWS Management Console
  2. Navigate to EC2 Dashboard
  3. Select your running instance
  4. Copy the Public IPv4 address (e.g., 54.123.45.67)

This IP is used as the destination in PuTTY.

Learn more about EC2 instances:
AWS EC2 Documentation


Step 2: Convert PEM to PPK Using PuTTYgen

PuTTY does not support .pem files directly. You must convert it into .ppk format.

Conversion steps:

  1. Open PuTTYgen
  2. Click Load
  3. Select your .pem file (change file filter to “All Files”)
  4. Click Save private key
  5. Save as .ppk file

This .ppk file will be used for authentication in PuTTY.


Step 3: Configure PuTTY for SSH Connection

  1. Open PuTTY
  2. In the Host Name field, enter your EC2 public IP
  3. Ensure Port = 22 and Connection type = SSH
  4. Navigate to:
    • Connection → SSH → Auth
  5. Browse and select your .ppk private key
  6. Click Open

You should now see a terminal prompt for login.


Step 4: Configure Security Group Rules (Critical Step)

If your connection fails, the issue is often related to security group settings.

To configure inbound SSH access:

  1. Go to EC2 Dashboard
  2. Select your instance
  3. Click the linked Security Group
  4. Open Inbound Rules
  5. Add or edit rule:
  • Type: SSH
  • Port: 22
  • Source: Your IP address (recommended)

⚠️ Avoid using 0.0.0.0/0 as it exposes your instance to the public internet.

Learn more about security groups:
AWS Security Groups Guide


Step 5: Troubleshooting Common SSH Issues

1. Connection Timeout or Refused

  • Check if security group allows port 22
  • Verify instance is running

2. Permission Denied (Public Key)

  • Ensure correct .ppk file is loaded in PuTTY
  • Confirm correct username (e.g., ec2-user, ubuntu)

3. IP Not Whitelisted

  • Your current IP must be added to inbound rules

Summary Table

TaskDescriptionExample
Find Public IPLocate instance IP in EC2 dashboard54.123.45.67
Setup PuTTY SSHConfigure PuTTY with IP + PPK fileConvert .pem to .ppk
Modify Security GroupAllow SSH traffic from your IPPort 22 from trusted IP

Key Takeaways

  • Secure SSH access requires properly configured security groups in Amazon EC2
  • PuTTY requires .ppk format keys, not .pem
  • Restrict SSH access to trusted IP addresses only
  • Most EC2 connection issues stem from incorrect inbound rules or key misconfiguration

Final Thoughts

Once configured correctly, PuTTY provides a reliable and secure SSH interface for managing EC2 instances from Windows environments. Proper handling of keys and security groups ensures both accessibility and protection of your cloud infrastructure.

Related Articles

AWS Testing Page


Discover more from Rotebit

Subscribe to get the latest posts sent to your email.

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply