Search code examples
amazon-web-servicesdockernginxamazon-ec2amazon-elb

EC2 status unhealthy in Target Groups


I am using AWS application load balancer to connect to a target group that has an EC2 instance with docker installed using cloud init scripts. I am executing an Nginx dockercontainer inside EC2.

I am getting a request time out exception as an information.

I connected to the target and checked if the service is available. I received nginx default page. Performing a curl -I on the internal IP also gives a response code as 200.

Please help me in understanding how I can troubleshoot this to get the root cause.

Thanks in advance


Solution

  • The configuration should be:

    • A security group on the Application Load Balancer (ALB-SG) permitting inbound traffic from, presumably, the whole Internet (0.0.0.0/0) on the appropriate ports (80, 443?)
    • A security group on the EC2 instance (App-SG) that permits inbound access from ALB-SG on the appropriate ports (80, 443?)

    That is, App-SG should specifically reference ALB-SG. (Type in the name, it will resolve to a sg-xxx ID.)