By using AWS re:Post, you agree to the Terms of Use

How to set the Load balancer service to route a certain host to a fargate task?


Currently I have plenty of ECS Fargate tasks, my question is I wanted to use the Load Balancer to forward all the request with certain host header to just a task only, maintaining the port numbers.

  • Hello, I don't believe AWS ALBs and Fargate currently support this functionality. However, you could try to add the target manually to the target group by public or private IP and remove other targets from your group. Alternatively, you could create a second service with only one running task and set up a separate load balancer for it.

    If you provide more details as to why you only want to route to one specific task, I may be able to brainstorm alternative solutions.

  • Hi, Currently I'm planning to deploy a scalable session based websocket server on AWS using Fargate, each user will assigned a room automatically once they request to join and their message transmission should be encrypted(SSL). I plan to do the SSL part on the load balancer and hoping to do as what you said for the address routing.

1 Answer
Accepted Answer

I'm not sure how to route to a particular fargate task. However, I think you can route to different fargate services based on incoming route paths in Application Load Balancer. You can create a ALB with different listeners along with its associated targets. Then, when you're creating fargate service, you can attach this load balancer.

You can refer this article -

answered 3 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions