AWS ECS Fargate and port mapping

Anton Zherdev picture Anton Zherdev · Jan 5, 2018 · Viewed 9.6k times · Source

I have two containers and they expose the same port. I want to run them in the same task as they are part of the same system. But I cannot do this with Fargate because there are no port mapping and the host port should be the same as container port for the awsvpc network mode (only supported by Fargate).

It's an essential feature of Docker and it's strange that it seems to be not supported by Fargate. Is there really no way to do this or I'm missing something?

Answer

Sunil Shakya picture Sunil Shakya · Feb 23, 2018

Use application load balancer to your service and set your custom port in target group and host port should be set the same as container port. This is our tested solution.