Ec2 instance is unresponsive

0

I have an ec2 t2.micro instance. Ubuntu 22.04 is running on it. I have setup a wordpress website on this server. Some times my server just become unresponsive. When it happens my website does not load , FTP , SSH nothing work. To solve this issue , I just stop and start the instance and it starts working again. When It happens , On EC2 dashboard It shows Connectivity Check fails . CPU usage credits are still available when i check Monitor tab. Can some one please help me to fix this issue?

Ankur
asked 10 months ago229 views
2 Answers
0

There are some troubleshooting guides available to help track down the problem. I think I would start by doing the following:

  1. Configuring EC2 Serial Console so that I can login when this happens.
  2. Install CloudWatch Agent to collect OS-level metrics
  3. Make sure I have a valid backup of the instance using Data Lifecycle Manager or something similar.
profile pictureAWS
EXPERT
kentrad
answered 10 months ago
0

My guess is your instance is running out of memory.

That's why it's fine at the start, but as the t2.micro has only 1GB of memory (which isn't a lot) your application may be trying to consume a little bit more memory, and then a little bit more, until it tries to use more memory than is available. It's here that the Linux memory manager comes into play, and will try to swap processes out of main memory and onto disk (it's more complicated, but that's the general gist of it). This in itself is CPU-intensive, and as free memory gets less and less the memory manager will spend more and more of its time (and more and more CPU) trying to free up pages of main memory, leaving fewer and fewer CPU cycles for anything else (including handling SSH requests for login).

I had a very similar issue once, same setup as you (t2.micro running Wordpress and Apache) which would run fine for maybe 2 or 3 weeks and then become unresponsive, and a reboot would bring it back (actually, a better fix was to restart Apache once a week).

Unfortunately the EC2 section of the AWS Console doesn't display metrics for memory use, so right away you can't prove this is what's happening to you. You'll need to setup CloudWatch agent to collect these https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Install-CloudWatch-Agent.html

profile picture
EXPERT
Steve_M
answered 10 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