# IVpc

Extends: IVpc
Extends: IResource, IVPCRef
Implemented by: VpcV2, VpcV2Base, 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#L138)
- Type last changed: v2.224.0 · 13 Nov 2025

## Properties

- `availabilityZones`: string[] — AZs for this VPC.

- `env`: [ResourceEnvironment](/cdk/api/v2/docs/aws-cdk-lib.interfaces.ResourceEnvironment.html) — The environment this resource belongs to.

  For resources that are created and managed in a Stack (those created by
  creating new class instances like `new Role()`, `new Bucket()`, etc.), this
  is always the same as the environment of the stack they belong to.

  For referenced resources (those obtained from referencing methods like
  `Role.fromRoleArn()`, `Bucket.fromBucketName()`, etc.), they might be
  different than the stack they were imported into.

- `internetConnectivityEstablished`: [IDependable](/cdk/api/v2/docs/constructs.IDependable.html) — Dependable that can be depended upon to force internet connectivity established on the VPC.

- `isolatedSubnets`: [ISubnet](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.ISubnet.html)[] — List of isolated subnets in this VPC.

- `node`: [Node](/cdk/api/v2/docs/constructs.Node.html) — The tree node.

- `privateSubnets`: [ISubnet](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.ISubnet.html)[] — List of private subnets in this VPC.

- `publicSubnets`: [ISubnet](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.ISubnet.html)[] — List of public subnets in this VPC.

- `stack`: [Stack](/cdk/api/v2/docs/aws-cdk-lib.Stack.html) — The stack in which this resource is defined.

- `vpcArn`: string — ARN for this VPC.

- `vpcCidrBlock`: string — CIDR range for this VPC.

- `vpcId`: string — Identifier for this VPC.

- `vpcRef`: [VPCReference](/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_ec2.VPCReference.html) — A reference to a VPC resource.

- `vpnGatewayId`: string — Identifier for the VPN gateway.

## Methods

- `addClientVpnEndpoint(id: string, options: ClientVpnEndpointOptions): ClientVpnEndpoint` — Adds a new client VPN endpoint to this VPC.

- `addFlowLog(id: string, options?: FlowLogOptions): FlowLog` — Adds a new Flow Log to this VPC.

- `addGatewayEndpoint(id: string, options: GatewayVpcEndpointOptions): GatewayVpcEndpoint` — Adds a new gateway endpoint to this VPC.

- `addInterfaceEndpoint(id: string, options: InterfaceVpcEndpointOptions): InterfaceVpcEndpoint` — Adds a new interface endpoint to this VPC.

- `addVpnConnection(id: string, options: VpnConnectionOptions): VpnConnection` — Adds a new VPN connection to this VPC.

- `applyRemovalPolicy(policy: RemovalPolicy): void` — Apply the given removal policy to this resource.

  The Removal Policy controls what happens to this resource when it stops
  being managed by CloudFormation, either because you've removed it from the
  CDK application or because you've made a change that requires the resource
  to be replaced.

  The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
  account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).

- `enableVpnGateway(options: EnableVpnGatewayOptions): void` — Adds a VPN Gateway to this VPC.

- `selectSubnets(selection?: SubnetSelection): SelectedSubnets` — Return information on the subnets appropriate for the given selection strategy.

  Requires that at least one subnet is matched, throws a descriptive
  error message otherwise.

- `with(...mixins: IMixin[]): IConstruct` — Applies one or more mixins to this construct.

  Mixins are applied in order. The list of constructs is captured at the
  start of the call, so constructs added by a mixin will not be visited.

  **Parameters**

  - `mixins` — The mixins to apply.

  **Returns:** This construct for chaining
