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
.pemprivate 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:
- Log in to AWS Management Console
- Navigate to EC2 Dashboard
- Select your running instance
- 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:
- Open PuTTYgen
- Click Load
- Select your
.pemfile (change file filter to “All Files”) - Click Save private key
- Save as
.ppkfile
This .ppk file will be used for authentication in PuTTY.
Step 3: Configure PuTTY for SSH Connection
- Open PuTTY
- In the Host Name field, enter your EC2 public IP
- Ensure Port = 22 and Connection type = SSH
- Navigate to:
Connection → SSH → Auth
- Browse and select your
.ppkprivate key - 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:
- Go to EC2 Dashboard
- Select your instance
- Click the linked Security Group
- Open Inbound Rules
- 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
.ppkfile 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
| Task | Description | Example |
|---|---|---|
| Find Public IP | Locate instance IP in EC2 dashboard | 54.123.45.67 |
| Setup PuTTY SSH | Configure PuTTY with IP + PPK file | Convert .pem to .ppk |
| Modify Security Group | Allow SSH traffic from your IP | Port 22 from trusted IP |
Key Takeaways
- Secure SSH access requires properly configured security groups in Amazon EC2
- PuTTY requires
.ppkformat 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.
Checkout this YouTube video
Related Articles
Discover more from Rotebit
Subscribe to get the latest posts sent to your email.

