lbragile
lbragile

Reputation: 8122

AWS ECS Frontend & Backend Communication

Based on AWS ECS architecture

@Marcin purposed an interesting idea, but I cannot wrap my head around how the ALB knows which target group to forward to, as my attempts with 2 listeners (HTTP 80 → Frontend & HTTP 5000 → Backend) did not work.

Let's say I have the following (as @Marcin purposed)

                                   |---> Target Group 1 ---> ECS Services for Frontend (private subnet)
Client ---> ALB (public subnet) ---|
                                   |---> Target Group 2 ---> ECS Service for Backend (private subnet)

Assume:

Reasoning for the above setup was that if client wants a frontend resource, the access http://www.example.com (port 80), but if the frontend makes an API request to the backend, it does so via http://www.example.com:5000/<end_point> (note the :5000).

However, this hangs due to timeout

POST http://www.example.com:5000/check net::ERR_CONNECTION_TIMED_OUT

I can see that both target groups pass their respective health-checks in AWS console

Did I get something wrong with the above reasoning, or is this a setup issue?

Upvotes: 3

Views: 1411

Answers (1)

Marcin
Marcin

Reputation: 238687

Based on the comments.

The issue was with luck of a rule in ALB's security group to allow port 5000. Thus, the solution was to add the needed rule.

Upvotes: 1

Related Questions