How to Connect to EC2 with SSH PuTTY?
![How to Connect to EC2 with SSH PuTTY?](/static/img/files/aws.webp)
Connecting to an Amazon Elastic Compute Cloud (EC2) instance using SSH (Secure Shell) is a fundamental skill for anyone managing cloud-based servers. One popular tool for this task is PuTTY, a free and open-source terminal emulator that supports various network protocols, including SSH. In this guide, we'll walk you through the step-by-step process of connecting to your EC2 instance using PuTTY.
Prerequisites:
Before we dive into the connection process, ensure you have the following:- An active AWS account with EC2 instances
- PuTTY installed on your local machine
Obtaining EC2 Instance Details:
- Log in to your AWS Management Console.
- Navigate to the EC2 Dashboard.
- Select your desired instance, noting the public IP address or DNS.
Download PuTTY and PuTTYgen:
- Download PuTTY and PuTTYgen from the official PuTTY website.
- PuTTY is used for SSH connections, while PuTTYgen is helpful for generating key pairs.
Generate SSH Key Pair:
- Open PuTTYgen and click "Generate" to create a new SSH key pair.
- Save the private key securely and copy the public key for later use.
Add Public Key to EC2 Instance:
- In the AWS EC2 Dashboard, select your instance.
- Click on "Actions" > "Security" > "Modify IAM Role."
- Add the public key to the list of authorized keys.
Configure PuTTY:
- Open PuTTY and enter the public IP address or DNS of your EC2 instance.
- In the left panel, navigate to "Connection" > "SSH" > "Auth."
- Browse and select the private key file you generated with PuTTYgen.
Initiate SSH Connection:
- Go back to the "Session" category on the left panel.
- Enter a name for your session in the "Saved Sessions" field and click "Save."
- Click "Open" to initiate the SSH connection.
Login to Your EC2 Instance:
- A terminal window will open, prompting you for the username.
- For Amazon Linux instances, use "ec2-user"; for other distributions, consult AWS documentation.
- Paste the previously copied public key when prompted for the password.
Congratulations, You're Connected!:
- You should now have successfully connected to your EC2 instance using PuTTY.
More Examples:
Troubleshooting Connection Issues:
- If you encounter any issues, ensure that your security group settings allow SSH traffic (port 22).
- Verify that your private key file is correctly loaded in PuTTY.
Customizing PuTTY Sessions:
- Explore PuTTY's settings to customize your sessions further.
- Adjust font size, colors, and other preferences to enhance your user experience.
Security Best Practices:
- Regularly update your PuTTY installation for the latest security patches.
- Rotate your SSH keys periodically for enhanced security.
Related Searches and Questions asked:
That's it for this topic, Hope this article is useful. Thanks for Visiting us.