EC2 - connection issue - instance unreachable until restart

0

Hello all,

I have a weird connection issue with my newly created EC2 instance. Instance is running but I can't connect to with Putty/SSH. Then I restart the instance and I can connect for few minutes. After ~2-3 mins. the connection gets dropped and the parallel running ping gets timed out (public ip and hostname). Then I cannot reconnect until I have restarted the instance.

I have already checked a couple of things and settings:

Putty:

  • changed IP to hostname and vice versa
  • changed "Seconds between keepalive": 5
  • changed "Max minutes before rekey": 2
  • changed "Minutes between GSS checks": 2
  • changed "Max data before rekey": 25M

Backend:

  • Public IP (elastic): ok
  • Intenet Gateway: ok, and attached
  • NAT Gateway: ok, and attached
  • Routing tables: ok, all inbound and outbound traffic + SSH + ping allowed
  • ACL Lists: ok
  • pingable after reboot for 2, 3 mins, then timeout until next restart

Linux:

  • Quick check of firewall: ufw inactive
  • apt-get update: fails, resolv doesn't work
  • Public key checked, authorizations checked: ok

Does anybody have an idea what's wrong here?

Many thanks Matthias

  • What instance family and size are you running? How is the CPU/memory usage in it?

  • Hi Tasio,

    this is a T2, micro instance. CPU/memory consumption should be ok. I have seen a spike for CPU usage up to 25% when restarting/connecting. As this is a unmodified new instance in original state (no additional packages or services installed), I think memory/CPU consumption should be ok.

    Thanks Matthias

  • Same behavior with another new instance with SLES. Any thoughts?

已提问 1 年前258 查看次数
2 回答
0

HI Tasio,

0.0.0.0/0 >> igw-bead07db All incoming traffic to be directed to the internet gateway

54.179.90.198/32 >> igw-bead07db External IP to internet gateway (= alternative to #1)

172.31.0.0/16 >> local (default internal route. I can't delete that one.)

Thanks Matthias

已回答 1 年前
  • I think there's nothing wrong with routing. Have you tried with a different instance type or with SSM Session Manager as I mentioned above?

-1

I've seen sometimes that t2.micro instances may not serve SSH connections if load in the instance is of certain importance (I can't really quantify it). Consider that t2 instances are "burstable" (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-credits-baseline-concepts.html) and you may be running out of resources to cope with the workload + SSH.

One thing to try is to SSH using AWS Systems Manager (SSM) Session Manager. If you're using Amazon Linux 2, the SSM agent is probably already installed. Have a look at the documentation to start SSH sessions over SSM.

profile pictureAWS
专家
Tasio
已回答 1 年前
  • Hello Tasio, thanks for your reply. I can't imagine that the instance runs out of resources because their is no load on it so far, except the freshly deployed Amazon Linux 2.

    Is that routing correct: Destination >> Target 0.0.0.0/0 >> igw-bead07db 54.179.90.198/32 >> igw-bead07db 172.31.0.0/16 >> local ?

    Could this be some timeout on the NI or on the NetworkManager in Linux? Because I even can't ping the external IP anymore after few minutes.

    Many thanks Matthias

  • What's the second route in that table for?

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则