skip to Main Content

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).

port mapping options in new console

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


  1. 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).

    enter image description here

    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.

    Login or Signup to reply.
  2. in the new console, Network mode has been moved to the 2nd page. only awsvpc and bridge are supported right now (and it defaults to awsvpc) 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 supports awsvpc network mode.

    By the way, please do submit feedback/feature requests/comments about the new console here: https://github.com/aws/containers-roadmap

    Thanks!

    Login or Signup to reply.
  3. 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):

    enter image description here

    After create the task definition create a new revision with JSON of your previous task definition:

    "portMappings": [
                {
                    "name": "appcat-8888-tcp",
                    "containerPort": 5000,
                    "hostPort": 8888,
                    "protocol": "tcp",
                    "appProtocol": "http"
                }
    

    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:

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search