ShortIQ

ShortIQ

Deployment

How to SSH Into AWS EC2 From Windows

A practical step-by-step guide to connecting to an AWS EC2 instance from Windows using OpenSSH or PuTTY, including PEM and PPK key handling.

April 24, 2026ShortIQ Editorial Team

What You Need Before Connecting

To SSH into an AWS EC2 instance from Windows, you need a few things ready first: the public IP or public DNS of the instance, the correct private key file, the right default username for the AMI, and a security group that allows inbound SSH on port 22.

Most connection problems are not really SSH client problems. They usually come from the wrong username, a blocked security group, the wrong key file, or trying to connect to an instance that does not have a public address.

  • AWS EC2 instance with a public IP or public DNS
  • Private key file such as .pem or .ppk
  • Port 22 allowed in the instance security group
  • Correct SSH username for the machine image

Know the Right Username for Your EC2 Instance

AWS does not use the same SSH username for every image. The username depends on the operating system or image family running on the instance. If the username is wrong, SSH can fail even when the key is correct.

These are common defaults: Ubuntu usually uses ubuntu, Amazon Linux often uses ec2-user, Debian often uses admin, and CentOS may use centos. Always confirm the AMI family before assuming the username.

txt
Ubuntu -> ubuntu
Amazon Linux -> ec2-user
Debian -> admin
CentOS -> centos

Method 1: Use Windows PowerShell With OpenSSH

Modern Windows systems usually include OpenSSH already, which means you can often use the PEM file directly without converting it. This is the simplest path if you are comfortable in PowerShell or Windows Terminal.

Open a terminal, go to the folder where the PEM file is stored, and run the SSH command using the correct username and instance address.

bash
ssh -i your-key.pem ubuntu@your-ec2-public-ip

Method 2: Use PuTTY on Windows

If you prefer PuTTY, you will usually need the private key in PPK format instead of PEM. That means you first convert the PEM file with PuTTYgen and then attach the resulting PPK file inside the PuTTY SSH auth settings.

This is a common setup for Windows users who already work with PuTTY instead of the built-in OpenSSH client.

txt
PuTTYgen:
1. Load the .pem file
2. Save private key as .ppk

PuTTY:
1. Session -> enter public IP or DNS
2. Connection -> SSH -> Auth -> Credentials
3. Browse and select the .ppk file
4. Connect

Check the EC2 Security Group First

If SSH times out instead of failing immediately, check the EC2 security group. The instance must allow inbound SSH on port 22 from your current IP address or from a broader range if that is truly necessary.

For safety, AWS users often allow port 22 only from their own current IP instead of opening it to the whole internet.

txt
Security Group Inbound Rule
Type: SSH
Protocol: TCP
Port: 22
Source: Your current IP

Use Public DNS or Public IP

When connecting from Windows over the internet, you need the public address of the EC2 instance, not the private internal address. In the AWS console, look at the instance details and copy either the public IPv4 address or the public IPv4 DNS name.

If the instance has no public address and is inside a private subnet, you will need another access method such as a bastion host, VPN, or Systems Manager Session Manager.

Common Connection Errors and Fixes

The most common EC2 SSH issues are predictable. Permission denied usually means the username or key is wrong. A timeout usually means the security group, route, or public address is wrong. If PuTTY rejects the key, check whether the key was converted properly from PEM to PPK.

When troubleshooting, always verify four things in order: instance running state, public address, security group port 22 rule, and correct username and key.

  • Permission denied -> wrong username or wrong key
  • Connection timed out -> port 22 blocked or public access missing
  • PuTTY key issue -> PEM not converted correctly to PPK
  • Host unreachable -> wrong IP or instance in private subnet

Example EC2 SSH Commands

Below are common PowerShell or terminal commands depending on the Linux image you launched on AWS. Replace the key filename and the public IP with your own values.

bash
ssh -i my-ec2-key.pem ubuntu@54.12.34.56
ssh -i my-ec2-key.pem ec2-user@54.12.34.56
ssh -i my-ec2-key.pem admin@54.12.34.56

When You Should Convert PEM to PPK

If you are using PowerShell OpenSSH, you usually do not need to convert the PEM file at all. But if your workflow depends on PuTTY, then converting PEM to PPK is the normal step.

That is why the PEM to PPK guide pairs naturally with this article: OpenSSH users can stay with PEM, while PuTTY users typically need PPK.

  • Use PEM directly with OpenSSH on Windows
  • Use PPK when connecting with PuTTY
  • Pick one workflow and keep it consistent

Best Practice After First Login

After the first successful login, update the server, confirm your SSH configuration, and make sure you know how you will manage deployments and access later. If the server is for production, do not treat the first connection as the finish line.

It is also wise to document which key belongs to which server so you do not mix staging, development, and production access later.

  • Run system updates after first login
  • Keep key-to-server mapping documented
  • Prefer narrow SSH security group rules
  • Review long-term access and deployment workflow

FAQ

Can I SSH into AWS EC2 from Windows without PuTTY?

Yes. If your Windows system has OpenSSH, you can often use the PEM file directly from PowerShell or Windows Terminal.

Do I need to convert PEM to PPK for AWS EC2?

Only if you are using PuTTY. If you use OpenSSH on Windows, the PEM file is usually enough.

Why does SSH say permission denied on EC2?

That usually means you are using the wrong SSH username or the wrong private key for the instance.

Why does EC2 SSH time out from Windows?

A timeout usually means port 22 is blocked in the security group, the instance has no public route, or you are using the wrong address.

What username should I use for EC2 SSH?

It depends on the AMI. Ubuntu commonly uses ubuntu, Amazon Linux uses ec2-user, Debian often uses admin, and CentOS may use centos.

Related free tools

If you want to turn this topic into action, use one of ShortIQ's free tools for campaign planning, UTM structure, or QR distribution.

Continue Reading

Explore more guides on link shortener SaaS strategy, Bitly alternatives, and white label link management.

Was this article helpful?

Tell us if this guide solved the problem or what was still missing. We use this to improve the blog and only follow up if you explicitly allow it.

We use this to improve tutorials, examples, and technical depth.