# SelectedSubnets

Result of selecting a subset of subnets from a VPC.

- Source: [`aws-ec2/lib/vpc.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-ec2/lib/vpc.ts#L434)
- Type last changed: v2.9.0 · 26 Jan 2022

## 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

- `availabilityZones`: string[] (required) — The respective AZs of each subnet.

- `hasPublic`: boolean (required) — Whether any of the given subnets are from the VPC's public subnets.

- `internetConnectivityEstablished`: [IDependable](/cdk/api/v2/docs/constructs.IDependable.html) (required) — Dependency representing internet connectivity for these subnets.

- `isPendingLookup`: boolean = 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.

- `subnetIds`: string[] (required) — The subnet IDs.

- `subnets`: [ISubnet](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.ISubnet.html)[] (required) — Selected subnet objects.
