CoderSathi
  • Tutorial
    • Java Tutorial
    • Swing Tutorial
    • JDBC Tutorial
    • Java String Tutorial
    • Servlet and JSP Tutorial
  • Mongo DB
  • AWS
  • DevOps
  • Linux
  • Git
Home > How to > How to Login/SSH to AWS EC2 linux instance?

How to Login/SSH to AWS EC2 linux instance?

Learn the concepts, implementation details, and practical steps with a clean developer-focused walkthrough.

Yuba Raj Kalathoki
By Yuba Raj Kalathoki
Last updated: July 1, 2026 ยท 2 min read ยท 0 Comments
Share: in X
SSH

Table of Contents

  • Use case
  • Prerequisites
  • SSH from Windows machine
    • Convert PEM to PPK file
    • SSH from putty
  • SSH from Linux or Mac
  • Conclusion

Use case

  1. Login/SSH to AWS Linux EC2 instance

Prerequisites

  • You already have a Linux EC2 instance running in AWS and port 22 is enabled for public access.
  • You must have a private key like mykey.pem (Privacy Enhanced Mail).
  • If you are using a Windows machine then SSH client should be installed. You can use Putty which is easy. You can download it from https://putty.org/.

SSH from Windows machine

Convert PEM to PPK file

When you install the putty you might already have puttygen installed. Hence, open it.

  1. Click on Load button
  2. Select the PEM file where you have saved in your local machine.
  3. Click Save Private Key button.
  4. Give a proper name and save it. It should save in .ppk format.

SSH from putty

  1. Now open the putty
  2. Select the Session category.
  3. On the Host Name (or IP address) field, type the ubuntu@yourIP if your ec2 instance is Ubuntu and ec2-user@yourIP if your ec2 instance is Amazon Linux AMI.
  4. Go to SSH category which is under Connection
  5. Expand to SSH after clicking + icon
  6. Click on Auth
  7. Click on Browse button
  8. Select the PPK file where you have saved earlier.
  9. Click open.
  10. You may see a small dialog to accept it if you are connecting first time. You must accept.

You should be able log in to ec2 instance.

SSH from Linux or Mac

  1. Locate to your PEM file.
  2. Give read permission to your PEM file with the command: sudo chmod 400 mykey.pem
  3. Type: ssh -i mykey.pem ubuntu@yourIP
  4. You may need to accept if you are trying first time.

With this above step, you should be able to login/ssh to your ec2 instance.

Conclusion

We are able to access our ec2 instance. Now, we can start to work on our ec2 instance.

Related Posts:

  • Send Email Using Java
  • How to Connect Java Application to a Remote Database…
  • How to Fix SSH Agent Forwarding on macOS: The…
  • How to Use AWS CloudFront Signed URLs in Spring Boot?
  • Setting Up an EC2 Instance with Amazon CloudFront…
  • How to Upload File to AWS EC2 Instance From Local Machine?
Tags:awsdevopsec2linuxssh
Was this article helpful?
โ† Previous ArticleRun Kibana behind Nginx proxy with basic authentication
Next Article โ†’Delete all directories and keep files in Linux

Leave a Comment Cancel reply

You must be logged in to post a comment.

Recent Posts

  • How to implement Passwordless Authentication in Spring Boot: A Step-by-Step Guide
  • How to Use AWS CloudFront Signed URLs in Spring Boot?
  • How to Fix SSH Agent Forwarding on macOS: The Ultimate Guide for Developers
  • How to Read AWS Secrets Manager in Spring Boot (Step-by-Step)
  • How to Fix “Public Key Retrieval is not allowed” MySQL JDBC Error
CoderSathi

Your go-to resource for Java, Spring Boot, Microservices, AWS, and modern development tutorials.

Linkedin

Quick Links

  • About
  • Contact

Popular Topics

  • Java
  • Spring Boot
  • AWS
  • DevOps
  • MongoDB
  • Linux
  • Git
  • How to
ยฉ 2026 CoderSathi. All rights reserved. Privacy Policy ยท Sitemap