7
votes

I want to be able to use an ALB (ELBv2) to route traffic to multiple port mappings that are exposed by a task of a given service.

Example --

Service A is composed of 1 Task running with Task Definition B.

Task Definition B has one 'Container' which internally runs two daemons on two different port numbers (port 8000 and port 9000, both TCP). Thus, Task Definition B has two ports that need to be mapped to the ALB.

I'm not too worried about the ports that the ALB exposes (they don't have to be 8000 and 9000, but will help if they were).

  • my-lb-dns.com:8000 -> myservice:8000
  • my-lb-dns.com:9000 -> myservice:9000

Any ideas on how to create multiple listeners and target groups to achieve this? Nothing in the Console UI is allowing me to do this, and the API has not been very helpful either.

Thanks a lot!

1
Hi @ultimoo, I'm struggling with the same scenario, did you manage to work it out?shmish111
@shmish111 nope, as of today you cannot have ecs services expose multiple ports over load balancers.ultimoo
Hi @ultimoo , I, too, have a similar scenario -- though not involving application load balancing -- with Apache Zookeeper. Each Zookeeper instance requires three ports for three distinct purposes (ports 2181, 2888, 3888). It is through these ports that a cluster of these Zookeeper instances (usually 3 to 5 of them) communicate with each other. But if, as you say (and as I see on the AWS GUI), that a ECS container cannot map more that port to the host, I suspect that this won't work either. Am I correct in my conclusion here?NYCeyes
Yes, you're correct.ultimoo

1 Answers

12
votes

After speaking with AWS support, it appears that the ECS service is geared toward micro-services that are expected to expose only one port. Having an ECS Service use an Application Load Balancer to map two or more ports isn't supported.

Of course, an additional Load Balancer can be manually added by configuring the appropriate target groups etc., but ECS will not automatically update the configuration when services are updated or scaled up, and also when the underlying container instances change.