PuTTY SSH to EC2

Beginner
9 min read
Updated: Nov 2026
5 examples
EC2 / SSH / PuTTY

Definition and Usage

PuTTY is a common Windows SSH client. With an EC2 instance, a stable public IPv4 (recommended), and a private key, you can open an interactive shell on your Linux instance.

What does SSH with PuTTY mean?

You connect over TCP port 22 with key-based authentication. PuTTY stores host, port, and a .ppk key in a saved session so you reconnect without retyping settings.

When should you use PuTTY?

Use it when you prefer the classic Windows toolkit and .ppk keys. Modern Windows also ships OpenSSH Client (ssh in PowerShell). Browser-based options include EC2 Instance Connect and Session Manager.

What you will configure

Hostname and username from the EC2 Connect panel, a .ppk under SSH Auth credentials, a saved session, and the first host-key acceptance—then a shell as ubuntu or ec2-user.

After SSH works

Use the same host, user, and key for SFTP in FileZilla, then install runtimes with Node.js on Ubuntu EC2.

Same materials as SFTP.

If PuTTY connects, FileZilla Site Manager can reuse the host, user, port 22, and private key.

PEM versus PPK.

If you only have a .pem, open PuTTYgen, load the PEM, then Save private key as .ppk. Skip conversion if you already downloaded .ppk at launch.

Prefer Elastic IP.

Ephemeral public IPv4 can change after stop/start. Attach an Elastic IP so saved PuTTY sessions keep working.

Core Concepts

Terms you will use while connecting:

ConceptMeaning
PuTTYWindows SSH client with saved sessions
PuTTYgenConverts .pem ↔ .ppk key formats
.ppkPuTTY private key file used for Auth credentials
Host NamePublic DNS or IPv4 of the EC2 instance
Port 22Default SSH port; security group must allow it
ubuntu / ec2-userDefault SSH users for Ubuntu vs Amazon Linux AMIs
Host keyServer fingerprint PuTTY caches on first Accept
Saved sessionNamed PuTTY profile with host + key settings

Prerequisites

Have these ready before you open PuTTY:

  • PuTTY installed from the official site: PuTTY download (includes PuTTYgen).
  • A running EC2 instance with public DNS or IPv4 (prefer an Elastic IP). Launch one with the EC2 launch guide if needed.
  • A matching .ppk private key, or a .pem you convert with PuTTYgen. Security group must allow inbound TCP 22 from your IP.
EC2 instances list with instance in running state
Amazon EC2

Examples

Copy host and user from EC2 Connect, configure PuTTY with a .ppk, save a session, then log in.

Example 1 — Copy the Public Hostname

Read the SSH host from the EC2 Connect panel.

  1. In the EC2 console, open Instances and select your instance.
  2. Choose Connect, then the SSH client tab.
  3. Copy the hostname shown for the example ssh command (public DNS or IP).
EC2 Connect SSH client tab showing example hostname
Amazon EC2

How It Works

  1. Public DNS or IPv4 both work as PuTTY Host Name.
  2. EC2 Connect shows the value that matches a working OpenSSH command.
  3. Elastic IP keeps this hostname stable across stop/start.
  4. Private IPs only work from inside the VPC, not from your home PC.

Example 2 — Note the Default Username

Match the AMI user so key auth succeeds.

  1. Stay on Connect → SSH client.
  2. Note the username in the sample SSH command (for example ubuntu or ec2-user).
EC2 Connect tab showing default SSH username
Amazon EC2

How It Works

  1. Ubuntu AMIs typically use ubuntu.
  2. Amazon Linux often uses ec2-user.
  3. Wrong user + right key still fails with “Server refused our key.”
  4. Use the same user later in FileZilla.

Example 3 — Set Host and Private Key

Fill Session host and SSH Auth credentials in PuTTY.

  1. Open PuTTY. On the Session screen, set Host Name (or IP address) to the value you copied (port 22).
  2. In the category tree, go to Connection → SSH → Auth → Credentials (in older versions, Auth or Auth / Credentials).
  3. Under Private key file for authentication, browse to your .ppk file.
PuTTY session dialog with EC2 hostname and port 22
PuTTY
PuTTY SSH Auth credentials with PPK private key
PuTTY

How It Works

  1. Port 22 must match the security group inbound rule.
  2. The .ppk must belong to the key pair attached at launch.
  3. Only have .pem? Convert with PuTTYgen (Load → Save private key)—see a short PEM to PPK walkthrough.
  4. Auth before Open—set the key before you start the session.

Example 4 — Save Session, Open, Accept Host Key

Persist settings and complete the first trust prompt.

  1. Return to Session, type a name under Saved Sessions, and choose Save.
  2. Select your saved session and choose Open.
  3. On first connect, verify the host key fingerprint if you need high assurance, then choose Accept.
PuTTY save session with a custom session name
PuTTY
PuTTY saved sessions list with Open button
PuTTY
PuTTY security alert accept host key
PuTTY

How It Works

  1. Saved sessions store host + key path so you do not reconfigure every time.
  2. Host key Accept caches the server fingerprint on this PC.
  3. Unexpected host key changes deserve investigation before you click Accept again.
  4. Timeout here usually means SG/port/IP—not the key yet.

Example 5 — Log In to the Shell

Type the AMI username and confirm you land in a prompt.

  1. At the login as: prompt, type the username from the EC2 Connect tab (for example ubuntu).
  2. With key auth configured, you should land in a shell without a password.
  3. Next: install Node with Node.js on Ubuntu EC2, or upload files with FileZilla.
PuTTY terminal logged in to Ubuntu on EC2
PuTTY

How It Works

  1. Key auth proves you hold the private key matching the instance.
  2. No password is normal for official Ubuntu/Amazon Linux AMIs.
  3. You are in the user home (for example /home/ubuntu).
  4. Prefer browser SSH? See EC2 Instance Connect when you cannot open port 22 from your network.

Edge Cases & Pitfalls

Most SSH failures are security group, wrong user, or missing .ppk.

timeout

Connection refused or timeout

Confirm Running state, public IP/DNS, and inbound TCP 22 from your current public IP (VPNs change this often).

key

Server refused our key

Wrong private key, wrong username for the AMI, or key not loaded under SSH → Auth / Credentials.

format

Only a .pem on disk

Convert with PuTTYgen before browsing Auth credentials, or use OpenSSH with the PEM instead.

host

Host key warning after replace

A new instance can legitimately change the fingerprint. Confirm the IP/DNS before Accept.

ip

Saved session fails after stop/start

Ephemeral public IPv4 changed. Attach an Elastic IP and update Host Name once.

auth

No supported authentication methods

Ensure the key matches the public key on the instance and the AMI expects key auth (not password-only).

Key Takeaways

  • EC2 Connect first: copy hostname and username from the SSH client tab.
  • .ppk under Auth: convert .pem with PuTTYgen when needed.
  • Save a session so you reopen host + key in one click.
  • Next: FileZilla SFTP or Node.js install on the same instance.

One line: host + AMI user + .ppk on port 22, save the session, Accept once, then login.

Frequently Asked Questions

Open PuTTYgen, choose Load, select your PEM file, then Save private key to write a .ppk file. In PuTTY, under Connection, SSH, Auth, Credentials, browse to that .ppk for authentication.
Official Ubuntu AMIs typically use ubuntu. Many Amazon Linux AMIs use ec2-user. Confirm in the EC2 console Connect dialog under the SSH client tab.
Check that the instance is running, has a public IP or reachable path, and that the security group allows inbound TCP 22 from your current public IP. Stopped instances and wrong security groups are common causes.
No. OpenSSH on macOS, Linux, or Windows can run ssh -i key.pem ubuntu@host. PuTTY is one convenient option on Windows, especially with .ppk keys.
The default is TCP port 22. Change it only if your server listens on a different SSH port and your security group matches.
Accept only when you trust you are reaching the intended instance. After you replace an instance, the host key may change legitimately; investigate unexpected changes before accepting.

Next: Node.js on the instance

Use the same SSH session to run apt, install npm, and set up a supported Node line.

Node.js on Ubuntu →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful