SSH into an AWS EC2 Instance
MD
R
MarkdownRe-gain SSH access to an EC2 instance when the keys were lost. Note: the keys are only downloadable on the first instance
List all identities
ssh-add -l
# SSH into AWS EC2 Instance With Your PEM File cp mykey.pem ~/.ssh/ chmod 600 mykey.pem ssh root@XX.XX.XXX.XXX -i ~/.ssh/mykey.pem ssh ubuntu@XX.XX.XXX.XXX -i ~/.ssh/mykey.pem ssh-add ~/.ssh/mykey.pem
# SSH into AWS EC2 Instance Without Your PEM File
- Stop instance
- Actions > Create new image (EBS)
- Check Images (left panel)
- Instances > Launch New Instance > Choose AMI 4.1 Create a new pair of keys
- Download new key pair
sudo chmod -R 600 mykey.pem - Access via SSH
ssh -i mykey.pem core@10.0.0.23
Created on 10/6/2017