Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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)

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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

Assume:

  • the ALB is accessible via http://www.example.com and listens on:
  • HTTP 80 → forward to target Group 1
  • HTTP 5000 → forward to target Group 2
  • frontend container is exposed on port 3000
  • backend container is exposed on port 5000
  • target group 1 maps to HTTP 3000
  • target group 2 maps to HTTP 5000

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?

>Solution :

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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading