简体   繁体   中英

AWS: Changing host port in EC2 based ECS task definition using new ECS Console

I am trying to create a new EC2 based ECS task definition using the new ECS console ( https://ap-south-1.console.aws.amazon.com/ecs/v2/task-definitions?region=ap-south-1 ). But in the port mapping section (which is part of Step 1) I only see the option to set Container port. I want this for an nginx container so container port 80 is fine, but I don't see any option to change host port (to 8080 for example).

新控制台中的端口映射选项

When I go to the next step I see Fargate is chosen as the default app environment. I change that to EC2 only and go to create the definition. It creates the definition with host port as 80 as well. If I try to create a new revision I see the same options as above and no way to change host port.

Is this just something that's not been implemented in the new console design? Or am I missing something here? As I see the proper options to change host port in the classic UI. Additionally, with this new UI I'm also not able to change things like network (defaults to awsvpc). It seems like this UI is geared completely to a Fargate type of application since all these options I talk about are not required to be configured for Fargate (as per my knowledge).

Thanks!

Unfortunately you cannot set host port, because the new ECS V2 console currently supports only awsvpc for the network mode.

From the console if we click the Info link:

The new Amazon ECS console experience currently only supports the awsvpc network mode, which provides the task with an elastic network interface (ENI).

在此处输入图像描述

For the awsvpc network mode, you can set only the container port, since this will be exposed through an ENI to your VPC. You would need bridge mode for being able to configure both the container and host ports.

The V2 console at this point is lacking in functionality compared to the older one. You would want to stick with the older one.

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