-
Notifications
You must be signed in to change notification settings - Fork 4k
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-ec2): Allow selecting subnets by Id or CIDR mask #15228
Comments
Thanks for the feature request -- and to those who've already 👍 it. Just so I understand the use case, this is functionality equivalent to using The quick (untested) version (as the intermediate workaround) looks like this: class SubnetIdSubnetFilter extends SubnetFilter {
constructor(private readonly subnetIds: string[]) { }
public selectSubnets(subnets: ISubnet[]): ISubnet[] {
return subnets.filter(s => this.subnetIds.includes(s.subnetId));
}
}
const subnetsById: SubnetSelection = {
subnetFilters: [new SubnetIdSubnetFilter('subnet-abc', 'subnet-efg', 'subnet-hij')]
} |
Yup, your understanding is correct. It would be nice to make the more common filtering use cases part of the library itself instead of us building our own custom filters. This is what we've typically been doing:
|
This PR adds a couple of basic SubnetFilters into the CDK directly so they don't have to be needlessly reimplemented. The `SubnetIdSubnetFilter` filters subnets by ID and the `CidrMaskSubnetFilter` filters subnets based on the CIDR netmask. closes #15228 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
This PR adds a couple of basic SubnetFilters into the CDK directly so they don't have to be needlessly reimplemented. The `SubnetIdSubnetFilter` filters subnets by ID and the `CidrMaskSubnetFilter` filters subnets based on the CIDR netmask. closes aws#15228 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
This PR adds a couple of basic SubnetFilters into the CDK directly so they don't have to be needlessly reimplemented. The `SubnetIdSubnetFilter` filters subnets by ID and the `CidrMaskSubnetFilter` filters subnets based on the CIDR netmask. closes aws#15228 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
I would like the ability to create a SubnetSelection based on the exact subnet ids or based or the CIDR range of subnets in a VPC. While
SubnetSelection
does allow specifying a list of explicit subnets to use, these use cases are probably common enough support first class without requiring a "custom" filter.Use Case
I would like this feature because some of the VPC's I'm using have multiple public and private subnets with different CIDR masks and the current subnet selection capability forces me to write my own filters on the list of
ISubnets
in the vpc and then pass them explicitly to theSubnetSelection
.Proposed Solution
Ideally I would like to do something like this:
or something like this:
This is a 🚀 Feature Request
The text was updated successfully, but these errors were encountered: