aws-cdk-lib.aws_ec2.SelectedSubnets

interface SelectedSubnets

LanguageType name
.NETAmazon.CDK.AWS.EC2.SelectedSubnets
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsec2#SelectedSubnets
Javasoftware.amazon.awscdk.services.ec2.SelectedSubnets
Pythonaws_cdk.aws_ec2.SelectedSubnets
TypeScript (source)aws-cdk-lib » aws_ec2 » SelectedSubnets

Obtainable from Vpc.selectSubnets()

Result of selecting a subset of subnets from a VPC.

Example

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

NameTypeDescription
availabilityZonesstring[]The respective AZs of each subnet.
hasPublicbooleanWhether any of the given subnets are from the VPC's public subnets.
internetConnectivityEstablishedIDependableDependency representing internet connectivity for these subnets.
subnetIdsstring[]The subnet IDs.
subnetsISubnet[]Selected subnet objects.
isPendingLookup?booleanThe subnet selection is not actually real yet.

availabilityZones

Type: string[]

The respective AZs of each subnet.


hasPublic

Type: boolean

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


internetConnectivityEstablished

Type: IDependable

Dependency representing internet connectivity for these subnets.


subnetIds

Type: string[]

The subnet IDs.


subnets

Type: ISubnet[]

Selected subnet objects.


isPendingLookup?

Type: boolean (optional, default: 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.