My EC2 is not answering correctly

0

I am learning AWS by deploying a WordPress site. I have created the instance, an RDS, a load balancer, and a domain. The issue is that my site is only available for around 10 to 15 minutes after I start the EC2 instance. I am unsure whether this is due to network interfaces causing issues in my environment or if there is another error with the target group.

asked 9 months ago203 views
2 Answers
0
Accepted Answer

As things appear to be running fine for 10 to 15 minutes, this suggests that your basic configuration is okay and there's nothing wrong with your security groups, target groups, listener rules and the like, otherwise it just wouldn't work to start with (that's not to say these definitely cannot be the problem, just that it's not the first place to start looking).

When you say the site is only available for 10 to 15 minutes, does this mean that it stops responding to queries from a web browser? Can you still SSH to the EC2 instance (making the assumption that it's running Linux) at this time, or is that method unresponsive as well?

One place to start looking would be under the Monitoring tab of the EC2 instance in AWS Console, and note if there is anything that looks concerning, e.g. if CPU usage becomes unusually high.

It would also be worthwhile setting up CloudWatch agent to collect more detailed system logs https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Install-CloudWatch-Agent.html - this may show that your root cause is exhaustion of some system resources.

If it turns out that EC2 isn't the root cause then analyse the other components, such as checking if anything in the RDS section of AWS Console shows something of concern there.

profile picture
EXPERT
Steve_M
answered 8 months ago
profile picture
EXPERT
reviewed 8 months ago
  • Hello, everyone!

    When the problem occurs, SSH does not provide me with any response either.

    As my next step, I will attempt to use the CloudWatch agent. Thank you for suggesting that.

  • This sounds like resource exhaustion, which isn't unusual when running Wordpress on a small EC2, but it usually runs for much longer than 15 minutes.

    What instance type are you running, and do you have anything else running on it besides the basic WordPress and webserver (Apache?) software?

    if you're not already doing this, one thing that comes to mind to reduce the load on the EC2 is doing the SSL offloading on the loadbalancer, and only passing plain HTTP on port 80 to the EC2 instance.

0

Hi,

This issue can come from many parts of your infrastructure.

For the Target Group, you have to check the health check parameter. The ALB will send the HTTP traffic to your EC2 only if your EC2 is healthy. For instance, if we have HealthCheckIntervalSeconds = 5 and HealthCheckIntervalSeconds = 30 (Default settings), we have to wait 5x30=2 minutes and 30 seconds before the ALB redirect the HTTP trafic to your EC2.

Does your EC2 pull data from internet when it starts ? Like updates, git pull etc. It slows down the launching of your EC2. It's preferable to create an AMI with all dependencies first.

Also, I assume that you have a database up and running when you launch your EC2. If your Wordpress App needs to be connected to your database to be healthy, your have to preload your database first. (at least the first time during the initialization phase)

Hope I could help you.

profile picture
Donov
answered 8 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