Export cdk/aws-ec2/NetworkUtil for Public Use
I was recently creating a VPC with a slightly complex setup in terms of AZ distribution. Due to that complex setup, an L2 VPC construct is out of the question -- as it seems to be over indexing on a specific use case/pattern.
I was looking at how L2 VPC construct works under the hood, and found the most beautiful hidden gem in vpc existence: NetworkUtils. This class is amazing. I tried to use it, and couldn't because it's not exported from aws-ec2 cdk, so I copied and pasted the fella. Works so smoothly with the mask as input and statefulness behind the scenes. It allowed me to create a very basic loop to see how many subnets I could hold at varying cidr ranges for my VPC. Wow! Amazing! This thing is so powerful for my complex use case and I love it.
I want to use it without copying and pasting though, hence the feature request.
Use Case
Can't use L2 VPC because of it's restrictive nature. Can use this amazing tool to sort out my CIDR block subnet usage.
Proposed Solution
Add network-util.ts to the exported index here: https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk/aws-ec2/lib/index.ts#L8
after cdk team re-reviews the API for it (since now it will be a permanent API and not an internal thing that can be changed).
- [x] :wave: I may be able to implement this feature request
- [ ] :warning: This feature might incur a breaking change
This is a :rocket: Feature Request
Do you also need NetworkBuilder? This needs some more effort than just exporting this file, it also contains some private things that can't exposed over jsii, like InvalidCidrRangeError.
Yeah, I think I may have confused the file with the name of the class. I wanted NetworkBuilder exported. I only use typescript, but I could see how other languages might want it as well :)
Should be tackled as part of https://github.com/aws/aws-cdk/issues/5927
This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.
Still an issue.
I agree, this is a very handy utility to make public. Specifically the NetworkBuilder class.
Any movement on this?
also interested in this 👀 at the moment I've simply copied the whole Class to be used internally cause it's so useful; I know it's a bad practice, but the fact that there is not much active development on it helped the decision. However would be very helpful to have it exported from AWS CDK