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!
3
Answers
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: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 needbridge
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.
in the new console, Network mode has been moved to the 2nd page. only
awsvpc
andbridge
are supported right now (and it defaults toawsvpc
) while we are working to add more features.The host port field will appear once the network mode is set to
bridge
– please note Fargate only supportsawsvpc
network mode.By the way, please do submit feedback/feature requests/comments about the new console here: https://github.com/aws/containers-roadmap
Thanks!
If you have to change yes! or yes! your host port by console you can create your task definition in the new console like below(Port name and App protocol have been added in the last version):
After create the task definition create a new revision with JSON of your previous task definition:
Pay attention to the field added: "hostPort": 8888
By the way the network mode(awsvpc) for example to bridge: "networkMode": "bridge"
Once create the new revision by JSON you’ll see something like below config: