Issue
I am new to ecr/ecs/ec2. I am starting to deploy my app to domain i've purchased. My application has a front end and a backend. My front end runs on localhost:3000 and calls on its backend api on localhost 5000. Are the port mappings on my local machine the same as when creating a task definition on aws?
Solution
I wish there was a simple yes/no answer to this. But there isn't.
ECS uses 4 networking modes. awsvpc, bridge, host and none. None is not relevant here as there is no networking there.
For awsvpc, the container gets its own ENI. Which means that your container will act as a host and the port that you expose will be the port that you serve on.
For bridge, you use the docker network and use ephemeral ports dynamically to map your container ports to. This mode is the best if you want to use multiple copies of the same container/task.
For host, the container bypasses docker network and uses the EC2 ENIs which limits you by not allowing to run multiple copies of the same container/task on the same EC2 instance if you plan to use port mappings.
This is explained in detail at: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-networking.html
Answered By - banavalikar