By using AWS re:Post, you agree to the Terms of Use

SSH into EC2 stops accepting connections after about 8 minutes

1

I've been able to re-create this. I create an Amazon Linux EC2 instance. I'm able to connect via SSH (via browser and terminal) so I know my network config and vpn and acls and security groups are all good. I'm able to connect no problem for about 8 minutes. I can exit and open an new SSH connection no problem. And then after about 8 minutes my connection will freeze and I'm no longer able to re-connect. Terminal just wont let me type. Using the browser SSH EC2 connect I get error "There was a problem connecting to your instance". If I stop the instance and then re-start the instance I can connect again. I'll be good for about 8 minutes (give or take). So I can originally SSH in no problem, and then after some period of time (8 mins or so) I can no longer SSH back in. This is repeatable. I have to stop the instance and then start it (reboot doesn't do the trick).

  • Were you able to figure this out? I think I have the same (or a very similar) issue. I configured a security group to allow me to ping the instance. I found that after starting or rebooting the instance, I can ping it from anywhere between 3-8 minutes (it's not consistent). When I can ping it, I can SSH into it. If I cannot ping it, then I also can't SSH into it. Very frustrating.

  • This is happening for me, too. looks like it is about 7 minutes after boot time. Windows and Linux both show the same problem.

  • Unfortunately haven't been able to solve this. I've tried new fresh security groups, vpcs, various linux types all to no avail. I use Azure in work, so just been learning and tooling around with AWS but this is definitely a blocker for me. All blogs talk about timeout intervals client and server side, messed with all of that as well to no avail.

  • I have heard back from AWS support on this. They report:

    "I'd like to inform you that the team has reverted with an update. The team has stated that they have made some troubleshooting steps and they have resolved the issue."

    And sure enough, it is now working as expected. So.... Make sure that you've taken all the troubleshooting steps necessary, like NACL review, public IP for instance, Security Group open enough, internet gateway on the subnet, and any other possible technical reasons for failure. Then, even with the free 'basic' account, enter an "account and billing" ticket, explaining the problem. Then a few days later, after some back and forth, they'll fix your account. If it is the same thing as it was for me.

    I wonder if they isolated my account by accident?

  • Thanks bullfrogmiah. I suspect there is a general account issue that support has to resolve for this issue. It's likely related to account being closed and then re-opened at some point in the past.

    This thread is what is most promising to me.

    https://repost.aws/questions/QUiMEROPieSmK3kw-3b6Kvlw/cannot-ssh-into-any-ec-2-s-a-few-minutes-after-starting

    I signed up for Developer support so I could open up a ticket and now support is "Work in Progress" for me. Hoping they resolve it so I can keep moving forward.

asked 9 months ago210 views
2 Answers
1

Have you tried looking at the Serial Console when your instance stops responding to SSH? That might show error messages or other indicators of what is happening. If not, you may be able to log into the instance and troubleshoot from there - for example, you might find it has run out of memory or there is a runaway process consuming all the CPU.

profile picture
EXPERT
answered 9 months ago
  • Thanks for the follow up. I can't actually get to log into the box to locally troubleshoot after about 10 minutes every time after launch. Using the Cloudwatch metrics everything on the box is fine (CPU, RAM, etc). I've been playing with an instance type (t2.micro) that doesn't allow Seriel Console, so haven't gotten to try that yet.

  • This happens to me, as well. I have tried different instance sizes, including t3.small, t3.medium and m6i.large

  • Hi Brettski, still no luck on this issue. Some other folks have chimed in here as well with similar issue. I've tried to increase timeout on client and server side, to no avail. I've tried with fresh clean vpcs, and security groups and ec2 instances to no avail. The only thing that works is to stop the instance and then start the instance. A reboot doesn't solve it either.

  • Hi Brettski just to confirm here the answers on this post https://repost.aws/questions/QUiMEROPieSmK3kw-3b6Kvlw/cannot-ssh-into-any-ec-2-s-a-few-minutes-after-starting are indeed correct. When you close an account, and then re-open it, not all services are restored fully. EC2 has some "blocks" around it that'll allow it to launch and run and connect, but after some time will kill all connections and just hang.

0
Accepted Answer

So this was tricky, but if you closed our AWS account at some point in the past, and then re-open the account, not all services are fully restored. Only a support ticket to AWS will enable them to fully "re-open" your account and unblock EC2. This is tricky issue as you can launch and even SSH in no prob for a while, but after some time (~7 to 8 mins) it'll kill your connection and freeze the machine. Long story short, to resolve this issue, open a ticket with AWS support.

answered 3 months 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.

Guidelines for Answering Questions