- Newest
- Most votes
- Most comments
Hello,
I think you'll need to add an extra layer to achieve this, as your ALB alone won’t handle this logic. For example, you could use a Lambda function that checks ECS tasks for active processes, selects the task with fewer than 3 processes, and then forwards the request to the right ECS task. In front of this you will need an API Gateway to expose an HTTPS endpoint.
As for stickiness, while Lambda can manage the routing logic, it doesn’t handle stickiness directly. Stickiness is typically managed by the ALB, but you can configure your Lambda to set cookies for session persistence if needed.
Another option would be to use an ALB with your Lambda function behind it. In this setup, the ALB routes the request to Lambda, and then Lambda sends the request to the appropriate ECS task, which might make stickiness easier to manage.
Hope that helps!
Relevant content
- asked 6 months ago
- Accepted Answerasked 9 months ago
- asked 4 months ago
- AWS OFFICIALUpdated 16 days ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 16 days ago
- AWS OFFICIALUpdated 5 months ago