SubnetFilter

class aws_cdk.aws_ec2.SubnetFilter

Bases: object

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.

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_ec2 as ec2

subnet_filter = ec2.SubnetFilter.availability_zones(["availabilityZones"])

Methods

select_subnets(_subnets)

Executes the subnet filtering logic, returning a filtered set of subnets.

Parameters:

_subnets (Sequence[ISubnet]) –

Return type:

List[ISubnet]

Static Methods

classmethod availability_zones(availability_zones)

Chooses subnets which are in one of the given availability zones.

Parameters:

availability_zones (Sequence[str]) –

Return type:

SubnetFilter

classmethod by_cidr_mask(mask)

Chooses subnets which have the provided CIDR netmask.

Parameters:

mask (Union[int, float]) –

Return type:

SubnetFilter

classmethod by_cidr_ranges(cidrs)

Chooses subnets which are inside any of the specified CIDR range.

Parameters:

cidrs (Sequence[str]) – List of CIDR ranges to filter subnets from.

Return type:

SubnetFilter

classmethod by_ids(subnet_ids)

Chooses subnets by id.

Parameters:

subnet_ids (Sequence[str]) –

Return type:

SubnetFilter

classmethod contains_ip_addresses(ipv4addrs)

Chooses subnets which contain any of the specified IP addresses.

Parameters:

ipv4addrs (Sequence[str]) –

Return type:

SubnetFilter

classmethod one_per_az()

Chooses subnets such that there is at most one per availability zone.

Return type:

SubnetFilter