DEV Community

Anush N U
Anush N U

Posted on

Connecting to an EC2 Instance using PuTTY: A Step-by-Step Guide

As a developer or system administrator, you often need to connect to your Amazon EC2 instances to perform various tasks, such as installing software, configuring systems, or troubleshooting issues. One popular tool for connecting to EC2 instances is PuTTY, a free and open-source SSH client for Windows. In this blog post, we'll walk you through the process of connecting to an EC2 instance using PuTTY.

Image description

Prerequisites
Before we begin, make sure you have the following:

1. PuTTY installed:
Download and install PuTTY from the official website.
https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

Image description
2. EC2 instance running:
Ensure your EC2 instance is up and running. With the security group of inbound rules from SSH to your IP address.

Image description

3. Key pair created:
Create a key pair (e.g., .pem file) for your EC2 instance. You can do this in the AWS Management Console or using the AWS CLI.

Image description

4. PuTTYgen installed:
PuTTYgen is a utility that comes with PuTTY. It's used to convert your .pem file to a .ppk file, which PuTTY can use.

Procedure:
follow the steps to connect the ec2 instance in PuTTY

Step 1: Convert Your .pem File to a .ppk File
ppk=putty private key.

If you have downloaded the .ppk file you can skip the Step 1
else

  1. Open PuTTYgen.
  2. Click File > Load private key and select your .pem file.
  3. Click Save private key and choose a location to save your .ppk file.

Image description
Step 2: Configure PuTTY

  1. Open PuTTY.
  2. In the Host Name (or IP address) field, enter the public DNS name or public IP address of your EC2 instance.

Image description

  1. In the Port field, enter 22 (the default SSH port).
  2. In the Connection type field, select SSH. Image description
  3. In the Private key file for authentication field, browse to and select your .ppk file.

Image description

Image description
Step 3: Connect to Your EC2 Instance

  1. Click Open to connect to your EC2 instance.
  2. If prompted, accept the SSH key by clicking Yes.
  3. You should now see a command prompt for your EC2 instance.

Image description

Conclusion

Connecting to an EC2 instance using PuTTY is a straightforward process. By following these steps and troubleshooting tips, you'll be able to securely access your EC2 instance and perform various tasks. Remember to always keep your .pem and .ppk files secure to prevent unauthorized access to your EC2 instance.

Top comments (0)