Reputation: 55
Please help! I've spent multiple days trying to ssh into my EC2 instance.
I'd been able to do this for the first 24 or so hours. Then as I was adding dependencies to my instance I got booted. Now I'm unable to get back in. At one point my Public DNS changed but I've accounted for this.
My security groups, VPCs, internet gateways, route tables, subnets, firewall, etc. seem to all be in order too.
What is the issue here? Please advise!
Upvotes: 0
Views: 2368
Reputation: 1
I could neither SSH and my instance was reachable before. Apache also could not reach and it was reaching.
By chance when I changed elastic IP, everything worked.
Hope this helps.
Upvotes: 0
Reputation: 22366
telnet ${TARGET_HOST_IP} 22
If this works and you can connect, then SSH server is up and running. If not, SSH server is not running, or the port 22 is not open.
If somehow the SSH server is down, there could be some ways to try to fix.
See User is reporting that they've unable to SSH into an EC2 instance in AWS? for the options such as mount the root EBS volume to another EC2, or use USEDATA to reconfigure.
If you can login, then make sure SSH server is up and running. Then make sure ~/.ssh/authorized_key has the public key. Verify /var/log/auth or /var/log/security to verify if login gets denied if try to ssh into the EC2 from outside.
If you can, shut the EC2 instance, take a ELB snapshot of the root volume, then mount it to another EC2 you can SSH into, and investigate dmesg, /var/log files for any errors that may prevent SSH connections. Verify ssh server configuration, ~/.ssh/ files.
Or simply copy the contents you need from the ELB snapshot to a new EC2 instance and replace the original one with the new one.
AWS is clear that to create a snapshot of the root ELB volume, the instance needs to be shutdown. Otherwise the integrity of the snapshot is not assured.
To restore the SSH public key or permission of the ~/.ssh folder, also see [User is reporting that they've unable to SSH into an EC2 instance in AWS?
Upvotes: 1