Skip to content
v2.273.0

SelectedSubnets Struct ​

Result of selecting a subset of subnets from a VPC.

Example ​

ts
const vpc = new ec2.Vpc(this, 'TheVPC', {
  ipAddresses: ec2.IpAddresses.cidr('10.0.0.0/16'),
})

// Iterate the private subnets
const selection = vpc.selectSubnets({
  subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS
});

for (const subnet of selection.subnets) {
  // ...
}

Properties ​

availabilityZonesstring[]availability_zonestyping.List[str]availabilityZonesList<String>AvailabilityZonesstring[]AvailabilityZones*[]*stringrequired#
The respective AZs of each subnet.
hasPublicbooleanhas_publicboolhasPublicBooleanHasPublicboolHasPublic*boolrequired#
Whether any of the given subnets are from the VPC's public subnets.
internetConnectivityEstablishedIDependableinternet_connectivity_establishedIDependableinternetConnectivityEstablishedIDependableInternetConnectivityEstablishedIDependableInternetConnectivityEstablishedIDependablerequired#
Dependency representing internet connectivity for these subnets.
isPendingLookupbooleanis_pending_lookupboolisPendingLookupBooleanIsPendingLookupboolIsPendingLookup*bool= false#
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.

subnetIdsstring[]subnet_idstyping.List[str]subnetIdsList<String>SubnetIdsstring[]SubnetIds*[]*stringrequired#
The subnet IDs.
subnetsISubnet[]subnetstyping.List[ISubnet]subnetsList<ISubnet>SubnetsISubnet[]Subnets*[]ISubnetrequired#
Selected subnet objects.