Application Load Balancer not registering ECS Fargate tasks automatically

0

Hi, we are developing a Dockerized web application and deploying to an ECS Fargate cluster. Here's what we have until now:

  1. An ECS Fargate service that is deployed on a public (for now) subnet.
  2. A target group using protocol HTTP on port 8080.
  3. An Application Load Balancer with the target group above as a listener also deployed on a public subnet.
  4. The security groups of the Load Balancer and ECS allowing everything (again, for now).

When ECS starts a task, I can get its private IP address and manually register to the target group and it works perfectly fine including the health checks and everything. My requests to the load balancer from my local machine are forwarded to the ECS tasks successfully, and I receive the expected responses.

The problem is the automatic registry of the ECS tasks within the target group. If I understand correctly, the target group should discover and register new tasks on the service automatically. Unfortunately it doesn't, I have to do that manually.

Why isn't it being added automatically? What am I missing here? Can you give me a hint on where to start diagnosing that?

Thank you for your time.

Edit: The problem was that the load balancer wasn't added to the ECS service itself. Once added, everything worked as expected.

2 回答
0
已接受的回答

The problem was that the load balancer wasn't added to the ECS service itself. Once added, everything worked as expected.

已回答 1 年前
  • Just as I said. Define the load balancer when setting up the ecs service.

0

Please ensure you create an Target Group of Instance type. When you register your ECS service in the ECS console, you define the load balancer and target group to use

When your ECS Servive starts, it registers its self in the target group

Sounds like your using a IP type target group?

profile picture
专家
已回答 1 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则