I have an ubuntu 18.04 based EC2 instance using an Elastic IP Address. I am able to SSH into the instance without any problems.
apt is executing some unattended updates on the instance. If I reboot the system after the updates, I am no longer able to SSH into the system. I am getting the error ssh: connect to host XXX port 22: Connection refused
Few points:
- Even after the updates, I am able to SSH before the reboot
- Method of restart does not make a difference.
sudo shutdown -r now
and EC2 dashboard have the same result. - There are no problems with sshd_config. I've detached the volume and attached it to a new working instance.
sshd -t
did not report any problems either - I am able to do
sudo systemctl restart ssh.service
after the updates but before the system restart. - I've tried with and without Elastic IP. Same result
- From the system logs, I see that SSH is trying to start, but failing for some reason
I want to find out why the ssh daemon is not starting. Any pointers?
Update:
- System Logs
- Client Logs
- No changes in the security groups before and after reboot
CodePudding user response:
EC2 > Network & Security > Security Groups > Edit inblound rules > SSH 0.0.0.0/0
CodePudding user response:
Step 1: EC2 > Instances > Actions > Image and templates > Create image
Step 2: Launch a new instance using the AMI image.