Skip to content

EC2 Instance SSH Stopped Connecting

0

Hi all, twice now I have spun up a t2.micro instance and after a while (maybe a day) it kicks me out and I get connection timeout when I try to reconnect. I followed all of the steps here https://repost.aws/knowledge-center/ec2-linux-resolve-ssh-connection-errors and no luck

Oddly the instance still serves HTTPS (443) requests. I didn't make any SG or VC changes, but I did ensure 0.0.0.0/0 is open on everything. Also disabled firewall via SSM console, and I can connect to other instances on my local machine.

I would love to know how to fix this, but I guess my real question is, how can this happen in the first place? One minute you can SSH. the next minute you can't.

Thanks for the insight

8 Answers
0

Hello.

What is the CPU usage rate and memory usage rate?
When t2.micro's CPU burst credits are used up, the performance drops to the baseline throughput, which may make SSH unusable.
By the way, t2.micro starts consuming burst credits when the CPU usage exceeds 10%.
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-credits-baseline-concepts.html

EXPERT
answered 2 years ago
0

Like 6% CPU - not sure where to see memory, not on the monitoring tab in EC2 instance dashboard

answered 2 years ago
0

Also, just spun up another fresh t2.micro instance and installed WordPress....same issue, still serves HTTPS but no longer SSH.

answered 2 years ago
0

sshd within the EC2 instance may have stopped due to some problem.
Connect to EC2 using Systems Manager Session Manager and check if there are any problems with sshd and check the system logs to see if any errors have occurred.
https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager.html

EXPERT
answered 2 years ago
0

Yeah, I had tried that (goes along with that link I posted). I was able to SSM, but logs didn't have anything to say.

answered 2 years ago
0

Can you confirm that sshd is running with the command below?
If sshd does not seem to be starting, try starting it with the following command.

sudo systemctl status sshd
sudo systemctl start sshd
EXPERT
answered 2 years ago
0

This didn't work. Bottom line, It randomly stops serving traffic on ports 443 and 22. The EC2 console in AWS says the instance is running, but it randomly stops serving traffic and after a while (maybe an hour) it will come back up again. I am not doing anything, it happens on it's own. This is a problem because my website keeps going offline

answered 2 years ago
0

Did you find a fix? I launched a new instance yesterday, used SSH to connect fine, did some stuff, then exited last night before going to bed. Went to SSH in again this AM and I keep getting a connection timeout, checked network interface, security groups, network ACLs, tried rebooting, and it still times out.

Didn't change anything since connecting last night, everything looks good, it won't connect.

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.