- Newest
- Most votes
- Most comments
Hii Chaitanya,
Check Health Check Path:
- Ensure that the health check path in your target group is set to /. This is the default path the ALB uses to determine the health of your instances.
Update User Data Script:
- Ensure your user data script is correct and includes the necessary commands to start Apache on boot. Here’s a more organized version:
#!/usr/bin/env bash
sudo yum update -y
sudo yum install httpd -y
sudo systemctl start httpd
sudo systemctl enable httpd
Security Groups:
- Ensure both the ALB and EC2 instance security groups allow inbound traffic on port 80.
Instance Status:
- Ensure the instance is running and the Apache service is active.
ALB and Target Group Configuration:
-
Navigate to the AWS Management Console.
-
Go to the EC2 Dashboard.
-
Under Load Balancing, select Target Groups.
-
Select your target group and check the Health Check settings.
-
Ensure the protocol is HTTP and the path is /.
Instance Tags:
- Ensure the instances are registered with the target group and the correct tags are applied if you're using tag-based instance registration.
Here is an example of how to configure the health check:
-
Protocol: HTTP
-
Path: /
-
Port: 80
Hello,
Ensure that the security group outbound rule for the ALB allow security group of the EC2 instance for HTTP traffic on port 80.
For troubleshooting unhealthy Target groups, refer this documentation: https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-troubleshooting.html#troubleshoot-with-resourcemap
Hello.
I can't say for sure without looking at the web server access log, but I think it's possible that index.html is not located in the document root and the health check is not successful.
If you are using Amazon Linux 2023, simply installing Apache will not create index.html and the ALB health check will fail.
So, try running the following command.
echo "test html" > /var/www/html/index.html
Hi.
First thing first: did you locally check (i.e. from within the EC2 instance itself via curl for example) that the health endpoint on your httpd server answers with http code 200 ?
I suggest making sure that you align with settings of https://docs.aws.amazon.com/elasticloadbalancing/latest/application/target-group-health-checks.html#health-check-settings
Best,
DIdier
Relevant content
- asked 2 years ago
- asked 3 years ago
- AWS OFFICIALUpdated 2 years ago
