-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
(aws-ecs): PortMapping should support ContainerPortRange #23509
Comments
Hello! Can I challenge this Issue? I think this can be achieved by changing the following code and related parts aws-cdk/packages/@aws-cdk/aws-ecs/lib/container-definition.ts Lines 1115 to 1123 in 09f8e9f
|
Sorry. |
Thanks for submitting the new issue @bun913, it's much appreciated and may help us deliver this particular feature faster |
I would also like to see this feature implemented |
Amazon ECS [supports](https://aws.amazon.com/it/about-aws/whats-new/2022/12/amazon-ecs-supports-container-port-ranges-port-mapping/) container port ranges for port mapping since quite a bit, however the `ContainerDefinition` L2 construct does not expose a way to set them. Right now, the only viable solution I found to use the feature is using Escape Hatches. Within this PR, the `containerPortRange` property is added to the `PortMapping` object and mapped back to the underlying L1 construct. The current implementation contains a breaking change: since setting both a port range and a single fixed port doesn't make sense, I had to mark optional all the properties of `PortMapping`, hence the `containerPort` property changed its type from `non-nullable` to `nullable`. The downside of the proposed solution is that now all the properties are optional and the compiler doesn't complain if an empty object is passed as port mapping. I added some runtime checks to ensure that a valid object is created, but I didn't find a better way to do it at compile time that is also compatible with the transformation done by `jsii`. Closes #23509. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
Describe the feature
This feature would make CDK on par with Cloudformation for the places where PortMapping is used.
Use Case
We're working on a project that uses an RTPEngine hosted on ECS Fargate, but this needs a specified range of UDP ports to be opened (ie 30000:40000).
Proposed Solution
Add the ContainerPortRange property to PortMapping, Cloudformation already supports it.
Or give the option to do a property override to add this property yourself.
Other Information
No response
Acknowledgements
CDK version used
2.57.0
Environment details (OS name and version, etc.)
Arch, Python 3.10
The text was updated successfully, but these errors were encountered: