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?

질문됨 일 년 전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

답변함 일 년 전
  • 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
답변함 일 년 전
  • 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?

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠