Introduction: How to Connect to AWS EC2 Instance by Using PuTTY Without Using .pem File?

Connecting to an AWS EC2 instance without a PEM file requires exploring an alternative authentication method: using a password instead of a secure key pair. AWS EC2 instances are cloud-based virtual server that are usually accessed via SSH with a PEM file for further protection. While using passwords is less secure than using SSH keys, there are chance of unauthorized access increased. 


Supplies

Note:


This method work when you have running connection with AWS EC2 instance.

Step 1: Enable Password Authentication on EC2 Instance

Log in to your AWS Management Console.

Go to the EC2 dashboard, Select your EC2 instance.

In the Description tab, locate the security group associated with your instance and make sure it allows inbound SSH traffic.

Connect to your EC2 instance using an existing PEM file, run command to edit the SSH configuration file:

sudo nano /etc/ssh/sshd_config

 Set PasswordAuthentication to yes.

Step 2: Set Password for User

Still connected to your instance, set a password for the desired user run command:

 sudo passwd [username]

Step 3: Restart the SSH Server

Restart the SSH server to make the changes effect, run command:

 sudo service ssh restart

Step 4: Configure PuTTY

Open PuTTY configuration window, Enter the public IP or DNS of your EC2 instance in the Host Name section.

Set the connection type to SSH and port to 22.

Step 5: Session Save

In the Saved Sessions section and click the "Save" button to save these settings for future use.

Step 6: Establish a Connection

To start the connection, click the Open button.

Enter the username and password when prompted.


By using PuTTY you can also connect to AWS instance without using .pem file.