
AWS Fargate
- (service AWS-service) (port 8080) is unhealthy in (target-grouparn:uxyztargetgroup/aws-targetgroup/123456789) due to (reason Health checks failed with these codes: [502]) or [request timeout]
- (service AWS-Service) (port 8080) is unhealthy in target-group tf-20190411170 due to (reason Health checks failed)
- If the container is mapped to port 80, then ensure that the container security group allows the load balancers inbound traffic on port 80.
- You must verify whether the load balancer health ping port value is properly configured or not. If the port is not properly configured, the load balancer could de-register the container itself.
- Verify the both ping port and health check path are properly configured.
- Define a minimum grace period for health checks. This informs the service scheduler to skip Elastic Load Balancing health checks once a task has been instantiated for a pre-defined amount of time.
- You should regularly monitor the CPU and memory statistics of the services.
- Monitor your application logs for any application errors.
- Check that your backend database is successfully connected.
Error 504 Troubleshooting
You will receive the error 504 due to any of the following reasons:- Load balancer fails to connect to the target before the connection expires.
- Load balancer connected to the target, but it failed to respond before the idle timeout period expired.
- Your subnet’s network access control list did not allow traffic from the targets to the load balancer nodes on the ephemeral ports.
- Confirm that the backend has responded successfully without delay.
- Set the correct response time-out value. The health check will fail if the value is lesser than the time required.
- Also, Check your load balancer’s access logs for more information about issues.
- First, confirm that you are passing the correct command to the container and syntax.
- If the task has been running for some time, then check your application logs as well as the Amazon CloudWatch logs.