3
votes

I know application load balancers are new in AWS, and discussions (help) are scarce up-to now.

I have a few api containers (docker) running in EC2 Container Service (ECS). I can take advantage of application load balancers to manage routing on an application level rather than a network level. This is exactly what ECS has lacked up until now.

Getting to the point...

I'm trying to get to a point where the load balancer will detect the pattern in the request url and route the request to the correct container, but route the request without the pattern included.

For example:

http://elb.eu-west-1.elb.amazonaws.com/app1/ping Should route request '/ping' to the app1 container

http://elb.eu-west-1.elb.amazonaws.com/app2/ping Should route request '/ping' to the app2 container

etc...

Each app has it's own target group and corresponding pattern: /app1*, /app2*


the problem

I can successfully get the a request to '/app1/ping' to route to the app1 container however the request hits the container as '/app1/ping' (obviously) but I only need '/ping' to hit the container. '/app1' is irrelevant to the container. Any ideas how I can achieve this?

1
I played around with application load balancer for half a day and realised the same thing. It's not intuitively designed. Keen to hear an answer for this. - n00b

1 Answers

0
votes

Application Load Balancers do a couple of things very well, but there's an awfull lot they do not do. This is true for a lot of AWS services (e.g. SQS just recently, after almost a decade got FIFO support) and you can either love or hate this.

Your use case seems to fit the AWS API Gateway very well, which is a service that can be used to map certain external endpoints to certain internal endpoints (and a lot more...). There's even a blog post on the AWS blog about how to use Application Load Balancing with the EC2 Container Service and the API Gateway together.