Want to connect to your AWS EC2 server using SSH? Follow these quick steps!
β Prerequisites
- β A running EC2 instance
- β
.pem
key file (downloaded from AWS) - β Public IP of your instance
- β Terminal (macOS/Linux) or PuTTY (Windows)
π οΈ Steps
1. Set permissions on your key file
chmod 400 your-key.pem
2. SSH into your EC2 instance
For Amazon Linux:
ssh -i your-key.pem ec2-user@your-ec2-ip
For Ubuntu:
ssh -i your-key.pem ubuntu@your-ec2-ip
Replace
your-key.pem
with your key file andyour-ec2-ip
with the public IP of your instance.
π§ Common Issues
- β Permission denied: Check the username and permissions of your key file
- π₯ Timeout: Ensure port 22 is open in your Security Group
π Quick Tips
- π Keep your
.pem
file private - π΅ Donβt share your key with anyone
- π§ Connect only from trusted devices
Thatβs it! Youβre now connected to your EC2 instance π
Simple, secure, and powerful.