2021年3月29日星期一

Aws ec2 - how to setup load balancer to match docker container on ec2 instance

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    
https://stackoverflow.com/questions/66864290/aws-ec2-how-to-setup-load-balancer-to-match-docker-container-on-ec2-instance March 30, 2021 at 11:08AM

没有评论:

发表评论