简体   繁体   中英

port mapping for AWS ECS

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?

在此处输入图像描述

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

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