# VpcAttributes

Properties that reference an external 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#L773)
- Type last changed: v2.60.0 · 12 Jan 2023

## Example

```ts
const vpc = ec2.Vpc.fromVpcAttributes(this, 'VPC', {
  vpcId: 'vpc-1234',
  availabilityZones: ['us-east-1a', 'us-east-1b'],

  // Either pass literals for all IDs
  publicSubnetIds: ['s-12345', 's-67890'],

  // OR: import a list of known length
  privateSubnetIds: Fn.importListValue('PrivateSubnetIds', 2),

  // OR: split an imported string to a list of known length
  isolatedSubnetIds: Fn.split(',', ssm.StringParameter.valueForStringParameter(this, `MyParameter`), 2),
});
```

## Properties

- `availabilityZones`: string[] (required) — List of availability zones for the subnets in this VPC.

- `isolatedSubnetIds`: string[] — List of isolated subnet IDs.

  **Default:** The VPC does not have any isolated subnets

  Must be undefined or match the availability zones in length and order.

- `isolatedSubnetIpv4CidrBlocks`: string[] — List of IPv4 CIDR blocks for the isolated subnets.

  **Default:** Retrieving the IPv4 CIDR block of any isolated subnet will fail

  Must be undefined or have an entry for every isolated subnet group.

- `isolatedSubnetNames`: string[] — List of names for the isolated subnets.

  **Default:** All isolated subnets will have the name `Isolated`

  Must be undefined or have a name for every isolated subnet group.

- `isolatedSubnetRouteTableIds`: string[] — List of IDs of route tables for the isolated subnets.

  **Default:** Retrieving the route table ID of any isolated subnet will fail

  Must be undefined or have a name for every isolated subnet group.

- `privateSubnetIds`: string[] — List of private subnet IDs.

  **Default:** The VPC does not have any private subnets

  Must be undefined or match the availability zones in length and order.

- `privateSubnetIpv4CidrBlocks`: string[] — List of IPv4 CIDR blocks for the private subnets.

  **Default:** Retrieving the IPv4 CIDR block of any private subnet will fail

  Must be undefined or have an entry for every private subnet group.

- `privateSubnetNames`: string[] — List of names for the private subnets.

  **Default:** All private subnets will have the name `Private`

  Must be undefined or have a name for every private subnet group.

- `privateSubnetRouteTableIds`: string[] — List of IDs of route tables for the private subnets.

  **Default:** Retrieving the route table ID of any private subnet will fail

  Must be undefined or have a name for every private subnet group.

- `publicSubnetIds`: string[] — List of public subnet IDs.

  **Default:** The VPC does not have any public subnets

  Must be undefined or match the availability zones in length and order.

- `publicSubnetIpv4CidrBlocks`: string[] — List of IPv4 CIDR blocks for the public subnets.

  **Default:** Retrieving the IPv4 CIDR block of any public subnet will fail

  Must be undefined or have an entry for every public subnet group.

- `publicSubnetNames`: string[] — List of names for the public subnets.

  **Default:** All public subnets will have the name `Public`

  Must be undefined or have a name for every public subnet group.

- `publicSubnetRouteTableIds`: string[] — List of IDs of route tables for the public subnets.

  **Default:** Retrieving the route table ID of any public subnet will fail

  Must be undefined or have a name for every public subnet group.

- `region`: string — The region the VPC is in.

  **Default:** The region of the stack where the VPC belongs to

- `vpcCidrBlock`: string — VPC's CIDR range.

  **Default:** Retrieving the CIDR from the VPC will fail

- `vpcId`: string (required) — VPC's identifier.

- `vpnGatewayId`: string — VPN gateway's identifier.
