-
Notifications
You must be signed in to change notification settings - Fork 4.4k
(aws-ec2): Allow selecting subnets by Id or CIDR mask #15228
Copy link
Copy link
Closed
Labels
@aws-cdk/aws-ec2Related to Amazon Elastic Compute CloudRelated to Amazon Elastic Compute Cloudeffort/smallSmall work item – less than a day of effortSmall work item – less than a day of effortfeature-requestA feature should be added or improved.A feature should be added or improved.p2
Description
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 the SubnetSelection.
Proposed Solution
Ideally I would like to do something like this:
const vpc = Vpc.fromLookup(this, "Vpc", {
vpcId: props.vpcId,
});
const subnetsById: SubnetSelection = {
subnetFilters: [SubnetFilter.byId('subnet-abc', 'subnet-efg', 'subnet-hij')]
}
or something like this:
const vpc = Vpc.fromLookup(this, "Vpc", {
vpcId: props.vpcId,
});
const subnetsByCidr: SubnetSelection = {
subnetFilters: [SubnetFilter.withCidrMask('26')]
}
- 👋 I may be able to implement this feature request
This is a 🚀 Feature Request
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
@aws-cdk/aws-ec2Related to Amazon Elastic Compute CloudRelated to Amazon Elastic Compute Cloudeffort/smallSmall work item – less than a day of effortSmall work item – less than a day of effortfeature-requestA feature should be added or improved.A feature should be added or improved.p2