Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port mappings: add support of port ranges #194

Closed
tuusberg opened this issue Dec 14, 2015 · 42 comments
Closed

Port mappings: add support of port ranges #194

tuusberg opened this issue Dec 14, 2015 · 42 comments
Assignees
Labels
ECS Amazon Elastic Container Service Proposed Community submitted issue Shipped This feature request was delivered.

Comments

@tuusberg
Copy link

Hi there!

Some applications do require wide range of open ports and the only option we have at the moment is to set them explicitly (e.g. one by one) when defining tasks.

I think that it would be useful to allow use of port ranges, like

{
          "hostPorts": 3000-3025,
          "containerPorts": 3000-3025,
          "protocol": "tcp"
}

Also, I've noticed that ecs-agent throws an error if there is > 100 ports specified in task definition, regardless of port numbers:

 Run tasks failed
 Reasons : RESOURCE:PORTS

Please advice.

@euank
Copy link

euank commented Dec 23, 2015

You're correct that we don't currently support specifying port ranges directly in task definitions.
I made sure the feature of port ranges is being tracked internally.

There is indeed a limit on the number of reserved and utilized ports. This limit, per the docs, is 50.

If you have more information on your use-case, it could help us in evaluating that limit.

Best,
Euan

@gkyar
Copy link

gkyar commented Feb 21, 2016

It would be nice to have this feature as I have a similar use case where the application requires a large number of ports (1 thousand ports) in order to communicate with the another instance running on a different host.

@margusbirk
Copy link

+1

@z0r1k
Copy link

z0r1k commented May 23, 2016

Since docker supports port ranges I would expect that it should be possible to specify port ranges by ECS agent too.
Also I can easily image use-case where wide range or ports should be used, for example video conference SFU which can handle up to 10k WebRTC connections.

@wei-m-teh
Copy link

+1

1 similar comment
@chenliu0831
Copy link

👍

@dolgafar
Copy link

dolgafar commented Jul 5, 2016

+1
WebRTC / RTP
(Should be easy to do, since it's now supported in docker)

@bhendo
Copy link

bhendo commented Sep 14, 2016

+1
Is there any status on the progress of this?
I'll add FTP to the mix of use cases.

@sebalas
Copy link

sebalas commented Sep 29, 2016

+1

2 similar comments
@tobiasc
Copy link

tobiasc commented Sep 30, 2016

+1

@RyanBowlby-Reflektion
Copy link

+1

@jamiegs
Copy link

jamiegs commented Nov 14, 2016

I would also like this to allow us to restrict containers to different ports so I can define security groups and only allow upstream services to access specific services running in ECS.

@adamdunkley
Copy link

+1

@euank I know this has been added to the use cases already, but FTP is what we require this for. We're adding passive ports in manually and we can only allow 49 concurrent PASV connections with the 50 port limit (with 1 for the control port on 21).

@pirasakat
Copy link

+1

@mihbor
Copy link

mihbor commented Apr 19, 2017

+1
At the very least the docs should mention ports parameter syntax is only partially supported.
http://docs.aws.amazon.com/AmazonECS/latest/developerguide/cmd-ecs-cli-compose.html
The way it's written currently implies that the listed parameters are supported as per the linked docker compose syntax (v1&2) docs, which prominently show examples of the use of ranges: https://docs.docker.com/compose/compose-file/compose-file-v2/#ports

@Dominik-K
Copy link

At least, the 50 ports limit should throw an useful error message in the agent. Currently it just shows this misleading events message (in the AWS console):

service [...] was unable to place a task because no container instance met all of its requirements. The closest matching container-instance [...] is already using a port required by your task.

@marccardinal
Copy link

+1

@liafizan
Copy link

liafizan commented Jun 1, 2017

Couchbase server cluster using ECS Weave but managing ports is becoming a pain:
21100 to 21299 (inclusive) Node to Node communication

@bs-thomas
Copy link

+1 I'm hosting a ftp proxy daemon, and it needs to support a range of ports for passive mode. The range is 200 ports, and is impossible to achieve at the moment. Are there any plans to support this?

@minzhang28
Copy link

+1

1 similar comment
@aabrahamian
Copy link

+1

@nswarnkar
Copy link

This is important requirement and we are going to hugely use ECS. Are you guys working on it ? When this could be available?

@tuusberg
Copy link
Author

tuusberg commented Aug 26, 2017

I created this issue more than a year ago.
Is there a chance that you guys would implement this feature in the near future?

@brainframe-me
Copy link

For those who are trying to setup an FTP server inside a ECS task container and are trying to allow PASV connections and bump into the limitations of ECS-agent. Please know that there is a simple solution that does not require you to define all potential dynamic pasv ports that you defined in your server configuration.
You simply need to set the NetworkMode of your TaskDefinition to 'host' instead of 'bridge'. This gives the container access to ports it dynamically opens (as is the case with passive FTP connections).
Obviously in your security group you still need to allow the dynamic range you use, but here you can use a range.
Hope this helps somebody, I lost quite some time trying to get this to work

@houqp
Copy link

houqp commented Oct 20, 2017

This is also a major blocker for us, is there a timeline for this?

@phil-lavin
Copy link

Confirmed that using NetworkMode: host instead of bridge does not require you to explicitly expose ports. Rather, all traffic to the host is directly mapped to the same port on the container. We've successfully run an RTP proxy for WebRTC inside ECS.

@Anamican
Copy link

For those who are trying to setup an FTP server inside a ECS task container and are trying to allow PASV connections and bump into the limitations of ECS-agent. Please know that there is a simple solution that does not require you to define all potential dynamic pasv ports that you defined in your server configuration.
You simply need to set the NetworkMode of your TaskDefinition to 'host' instead of 'bridge'. This gives the container access to ports it dynamically opens (as is the case with passive FTP connections).
Obviously in your security group you still need to allow the dynamic range you use, but here you can use a range.
Hope this helps somebody, I lost quite some time trying to get this to work

Thank you very much, after struggling for two days, this finally helped !

@abby-fuller abby-fuller transferred this issue from aws/amazon-ecs-agent Mar 6, 2019
@abby-fuller abby-fuller added ECS Amazon Elastic Container Service Proposed Community submitted issue labels Mar 7, 2019
@houey
Copy link

houey commented May 6, 2019

Obviously in your security group you still need to allow the dynamic range you use, but here you can use a range.

Does this mean we can specify a narrower range of ports in the Security Group? is there a setting to match the dynamic port range to the Security group port range... IE we dont need 20,000 ports as a possibility.

@kerryjj
Copy link

kerryjj commented Oct 18, 2019

+1

Erlang node clustering. Ports 4369 and the range 9100 - 9155 are the default.

@ccapndave
Copy link

+1

1 similar comment
@kazz187
Copy link

kazz187 commented Feb 7, 2020

+1

@bramevo
Copy link

bramevo commented Feb 20, 2020

+1 (FTP)

@asandeep
Copy link

+1

Running dask worker with --nprocs > 1 assigns multiple ports that can be controlled by specifying a range i.e. --worker-port 9000:9100.

Currently it requires to add all the ports individually.

@luis02lopez
Copy link

+1 as per PCI DSS requirements of not having that huge amount of open ports.

@mmoallemi99
Copy link

Confirmed that using NetworkMode: host instead of bridge does not require you to explicitly expose ports. Rather, all traffic to the host is directly mapped to the same port on the container. We've successfully run an RTP proxy for WebRTC inside ECS.

In Fargate only awsvpc network mode is accepted and I'm also struggling with port range specification for a WebRTC application.

@hyavari
Copy link

hyavari commented Apr 9, 2021

+1
Required for RTP protocol.

@ogonzalez-sd
Copy link

ogonzalez-sd commented Jul 27, 2021

+1

We're using fargate to house a TURN (rfc5766) server and this would really be helpful!

@shlomisas
Copy link

+1

@webpolis
Copy link

webpolis commented Nov 12, 2021

In Fargate only awsvpc network mode is accepted and I'm also struggling with port range specification for a WebRTC application.

what was your solution @mmoallemi99 ?

I'm trying to find if there's a way to support WebRTC using ECS FARGATE.

The ICE negotiation works great (tested using this tool) both outside or inside a container, but I am still unable to establish communication from outside with a peer located inside a container. All Security Groups and Network ACLs currently allow TCP/UDP traffic for WebRTC interaction.

@mmoallemi99
Copy link

In Fargate only awsvpc network mode is accepted and I'm also struggling with port range specification for a WebRTC application.

what was your solution @mmoallemi99 ?

I'm trying to find if there's a way to support WebRTC using ECS FARGATE.

The ICE negotiation works great (tested using this tool) both outside or inside a container, but I am still unable to establish communication from outside with a peer located inside a container. All Security Groups and Network ACLs currently allow TCP/UDP traffic for WebRTC interaction.

I remember taking care of it with Terraform range function, pragmatically generating static port values in the end.

@httpiga
Copy link

httpiga commented Mar 16, 2022

Any update about this?

@vibhav-ag
Copy link

https://aws.amazon.com/about-aws/whats-new/2022/12/amazon-ecs-supports-container-port-ranges-port-mapping/

@vibhav-ag vibhav-ag added Shipped This feature request was delivered. and removed Work in Progress labels Dec 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ECS Amazon Elastic Container Service Proposed Community submitted issue Shipped This feature request was delivered.
Projects
None yet
Development

No branches or pull requests