简体   繁体   中英

How to use Application Load Balancer for an ECS Service with multiple port mappings?

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!

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM