class SubnetFilter
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.EC2.SubnetFilter |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awsec2#SubnetFilter |
![]() | software.amazon.awscdk.services.ec2.SubnetFilter |
![]() | aws_cdk.aws_ec2.SubnetFilter |
![]() | aws-cdk-lib » aws_ec2 » SubnetFilter |
Contains logic which chooses a set of subnets from a larger list, in conjunction with SubnetSelection, to determine where to place AWS resources such as VPC endpoints, EC2 instances, etc.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ec2 as ec2 } from 'aws-cdk-lib';
const subnetFilter = ec2.SubnetFilter.availabilityZones(['availabilityZones']);
Initializer
new SubnetFilter()
Methods
Name | Description |
---|---|
select | Executes the subnet filtering logic, returning a filtered set of subnets. |
static availability | Chooses subnets which are in one of the given availability zones. |
static by | Chooses subnets which have the provided CIDR netmask. |
static by | Chooses subnets which are inside any of the specified CIDR range. |
static by | Chooses subnets by id. |
static contains | Chooses subnets which contain any of the specified IP addresses. |
static one | Chooses subnets such that there is at most one per availability zone. |
selectSubnets(_subnets)
public selectSubnets(_subnets: ISubnet[]): ISubnet[]
Parameters
- _subnets
ISubnet
[]
Returns
ISubnet
[]
Executes the subnet filtering logic, returning a filtered set of subnets.
static availabilityZones(availabilityZones)
public static availabilityZones(availabilityZones: string[]): SubnetFilter
Parameters
- availabilityZones
string[]
Returns
Chooses subnets which are in one of the given availability zones.
static byCidrMask(mask)
public static byCidrMask(mask: number): SubnetFilter
Parameters
- mask
number
Returns
Chooses subnets which have the provided CIDR netmask.
static byCidrRanges(cidrs)
public static byCidrRanges(cidrs: string[]): SubnetFilter
Parameters
- cidrs
string[]
— List of CIDR ranges to filter subnets from.
Returns
Chooses subnets which are inside any of the specified CIDR range.
static byIds(subnetIds)
public static byIds(subnetIds: string[]): SubnetFilter
Parameters
- subnetIds
string[]
Returns
Chooses subnets by id.
static containsIpAddresses(ipv4addrs)
public static containsIpAddresses(ipv4addrs: string[]): SubnetFilter
Parameters
- ipv4addrs
string[]
Returns
Chooses subnets which contain any of the specified IP addresses.
static onePerAz()
public static onePerAz(): SubnetFilter
Returns
Chooses subnets such that there is at most one per availability zone.