Connect to AWS EC2 Instance via Putty/SSH

For connecting to your AWS EC2 instance, you can do it via Putty (for Windows user) or via SSH (for Linux/Mac user).

Assuming that you have created an AWS EC2 Instance and Key Pair (.pem file) is locally available for connection. If not then you can follow our below posts to complete these prerequisites.

First, find your EC2 instance Public DNS

Connect to AWS EC2 Instance via SSH_1

For Windows Users

Step1: Download Putty and putty gen from here

Step 2: Use putty gen to convert .PEM file to .PPK file. See Blog: How to convert .PEM file to .PPK file using putty gen

Step 3: Launch Putty and enter the host IP address and set the port to 22.

Connect to AWS EC2 Instance via SSH_2

Step 4: Navigate to Connection/SSH/Auth. Click “Browse” and select the .PPK file you exported from putty gen.

Connect to AWS EC2 Instance via SSH_3

For Mac/Linux users

Step 1: Use the chmod command to make sure your private key file isn’t publicly viewable. For example, if the name of your private key file is my-key-pair.pem, use the following command:

Step 2: Use the ssh command to connect to the instance. You’ll specify the private key (.pem) file and user_name@public_dns_name.
Example:- For Ubuntu, the username is ubuntu. For Fedora, the user name is either fedora or ec2-user.

You’ll see a response like the following.

Step 3: Enter yes and You’ll see a response like the following.