Reputation: 6469
Background
I am having an EC2 instance, and a docker container running on port 3030.
In my docker container, there is a nodejs server which contain REST api setting.
I just create an Application Load Balancer with a target group(HTTP: 80) which points to above ec2 instance, in order to setup public http endpoint to send api request
The DNS name of the Load Balancer is my-docker-test-server-dev-123456789.ap-southeast-1.elb.amazonaws.com.
Problem
I tried to send http request POST https://my-docker-test-server-dev-123456789.ap-southeast-1.elb.amazonaws.com/login
in order to try the login api on Postman,
but error occurs
HTTP 504: Gateway timeout
Update
I am using default security group for my load balancer.
Inbound Rule
Type Protocol Port range Source Description - optional
All traffic All All 0.0.0.0/0 –
All traffic All All ::/0 –
All traffic All All sg-d987a2bc / default –
Update 2
Now updated the target group to point to HTTP:3030 as suggested by comment, but still same errors.
Health Check for the group:
unhealthy
Request timed out
Update 3
EC2 Instnace > Security
Inbound Rule
Port range Protocol Source Security groups
22 TCP 0.0.0.0/0 launch-wizard-9
Upvotes: 4
Views: 2611
Reputation: 238309
Based on the comments.
The issue was by incorrectly set security group (SG) of the instances and the target group (TG) port. In the first case, since the docker application is exposed on the port 3030 on the instance, SG must allow inbound traffic on that port. The inbound SG rule was missing.
In the TG case, the original traffic port was 80. However, since the docker works at port 3030, TG port needed to be change to port 3030.
So the traffic looks as follows:
Clinet ---(HTTP:80) ---> ALB ---> TG --- (HTTP:3030) ---> Instance with docker on port 3030
Upvotes: 3