aws-cdk icon indicating copy to clipboard operation
aws-cdk copied to clipboard

Export cdk/aws-ec2/NetworkUtil for Public Use

Open iph opened this issue 6 years ago • 8 comments

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

iph avatar Mar 25 '20 18:03 iph

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.

rix0rrr avatar Apr 16 '20 09:04 rix0rrr

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

iph avatar Apr 16 '20 19:04 iph

Should be tackled as part of https://github.com/aws/aws-cdk/issues/5927

rix0rrr avatar Aug 12 '20 12:08 rix0rrr

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.

github-actions[bot] avatar Jun 17 '22 16:06 github-actions[bot]

Still an issue.

Obirah avatar Jun 19 '22 18:06 Obirah

I agree, this is a very handy utility to make public. Specifically the NetworkBuilder class.

damnhandy avatar Aug 06 '22 16:08 damnhandy

Any movement on this?

damnhandy avatar Sep 09 '22 22:09 damnhandy

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

adriantaut avatar Jul 18 '24 05:07 adriantaut