aws / aws/aws-cdk

Export cdk/aws-ec2/NetworkUtil for Public Use

Open
#7,013 8 comments 5 reactions 0 assignees View on GitHub
@aws-cdk/aws-ec2 effort/small feature-request p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

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](https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk/aws-ec2/lib/network-util.ts#L17). 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

Contributor guide

Open the contributing guide

Research direction

Start by reading packages/@aws-cdk/aws-ec2/lib/network-util.ts and the export list in packages/@aws-cdk/aws-ec2/lib/index.ts. Review the class as a permanent public API with the CDK team’s compatibility expectations; done means consumers can import NetworkUtil from aws-ec2 without copying the file.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cloud, developer-experience, infrastructure
Issue type
Feature
Difficulty
2/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.