SelectedSubnets

class aws_cdk.aws_ec2.SelectedSubnets(*, availability_zones, has_public, internet_connectivity_established, subnet_ids, subnets, is_pending_lookup=None)

Bases: object

Result of selecting a subset of subnets from a VPC.

Parameters:
  • availability_zones (Sequence[str]) – The respective AZs of each subnet.

  • has_public (bool) – Whether any of the given subnets are from the VPC’s public subnets.

  • internet_connectivity_established (IDependable) – Dependency representing internet connectivity for these subnets.

  • subnet_ids (Sequence[str]) – The subnet IDs.

  • subnets (Sequence[ISubnet]) – Selected subnet objects.

  • is_pending_lookup (Optional[bool]) – The subnet selection is not actually real yet. If this value is true, don’t validate anything about the subnets. The count or identities are not known yet, and the validation will most likely fail which will prevent a successful lookup. Default: false

ExampleMetadata:

infused

Example:

vpc = ec2.Vpc(self, "TheVPC",
    cidr="10.0.0.0/16"
)

# Iterate the private subnets
selection = vpc.select_subnets(
    subnet_type=ec2.SubnetType.PRIVATE_WITH_NAT
)

for subnet in selection.subnets:
    pass

Attributes

availability_zones

The respective AZs of each subnet.

has_public

Whether any of the given subnets are from the VPC’s public subnets.

internet_connectivity_established

Dependency representing internet connectivity for these subnets.

is_pending_lookup

The subnet selection is not actually real yet.

If this value is true, don’t validate anything about the subnets. The count or identities are not known yet, and the validation will most likely fail which will prevent a successful lookup.

Default:

false

subnet_ids

The subnet IDs.

subnets

Selected subnet objects.