🚀 Mastering the Cloud?
Join the Ram N Java community for high-quality AWS and Spring Boot tutorials!
SUBSCRIBE TO THE CHANNELIntroduction
Connecting to an Amazon EC2 instance via SSH is a critical skill for any developer or DevOps engineer. Whether you're deploying a Spring Boot application or managing a server, SSH allows you to securely access your Linux machine from anywhere. In this guide, we'll walk through the entire process using an intermediate Linux machine and a .pem key file.
Step 1: Prepare Your Key File (.pem)
When you first launch an EC2 instance, AWS provides a .pem file (private key). You must have this file to authenticate your connection. If you are using a Linux machine to jump into another EC2 instance, follow these steps:
- Open WinSCP or any file transfer tool.
- Upload your
.pemfile to the Linux machine you are currently logged into. - Verify the file exists by running the
lscommand in your terminal.
Step 2: Secure Your Key File
SSH requires that your private key file is not publicly viewable. If the permissions are too open, the connection will be rejected. Run the following command to set the correct permissions:
chmod 400 your-key-file.pem
Step 3: Get Connection Details from AWS
To connect, you need the Public DNS or IP address of your instance:
- Go to the AWS EC2 Console.
- Select your running instance and click Connect.
- Under the SSH Client tab, copy the example command provided by AWS.
Step 4: Execute the SSH Command
Using the details from AWS, run the SSH command in your terminal. The structure looks like this:
ssh -i "your-key-file.pem" ec2-user@your-public-dns-name
Once you hit Enter, you'll be securely logged into your Amazon EC2 instance!
Conclusion
Congratulations! You've successfully connected to your AWS EC2 instance via SSH. This foundation allows you to install software, manage files, and deploy applications like Spring Boot with ease. Remember to keep your .pem files secure and never share them publicly!
Great post and informative blog. it was awesome to read, thanks for sharing
ReplyDeleteDevOps Training
DevOps Online Training
DevOps Training in Hyderabad
DevOps Project Training
DevOps Training in Ameerpet
DevOps Training Institute in Ameerpet
DevOps Online Training in Hyderabad
Great post and informative blog. it was awesome to read, thanks for sharing
ReplyDeleteDevOps Training
DevOps Online Training
DevOps Training in Hyderabad
DevOps Project Training
DevOps Training in Ameerpet
DevOps Training Institute in Ameerpet
DevOps Online Training in Hyderabad