aws-cdk-lib.aws_ec2.IVpc

interface IVpc

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

Implemented by Vpc

Obtainable from Vpc.fromLookup(), Vpc.fromVpcAttributes()

Properties

NameTypeDescription
availabilityZonesstring[]AZs for this VPC.
envResourceEnvironmentThe environment this resource belongs to.
internetConnectivityEstablishedIDependableDependable that can be depended upon to force internet connectivity established on the VPC.
isolatedSubnetsISubnet[]List of isolated subnets in this VPC.
nodeNodeThe tree node.
privateSubnetsISubnet[]List of private subnets in this VPC.
publicSubnetsISubnet[]List of public subnets in this VPC.
stackStackThe stack in which this resource is defined.
vpcArnstringARN for this VPC.
vpcCidrBlockstringCIDR range for this VPC.
vpcIdstringIdentifier for this VPC.
vpnGatewayId?stringIdentifier for the VPN gateway.

availabilityZones

Type: string[]

AZs for this VPC.


env

Type: ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.


internetConnectivityEstablished

Type: IDependable

Dependable that can be depended upon to force internet connectivity established on the VPC.


isolatedSubnets

Type: ISubnet[]

List of isolated subnets in this VPC.


node

Type: Node

The tree node.


privateSubnets

Type: ISubnet[]

List of private subnets in this VPC.


publicSubnets

Type: ISubnet[]

List of public subnets in this VPC.


stack

Type: Stack

The stack in which this resource is defined.


vpcArn

Type: string

ARN for this VPC.


vpcCidrBlock

Type: string

CIDR range for this VPC.


vpcId

Type: string

Identifier for this VPC.


vpnGatewayId?

Type: string (optional)

Identifier for the VPN gateway.

Methods

NameDescription
addClientVpnEndpoint(id, options)Adds a new client VPN endpoint to this VPC.
addFlowLog(id, options?)Adds a new Flow Log to this VPC.
addGatewayEndpoint(id, options)Adds a new gateway endpoint to this VPC.
addInterfaceEndpoint(id, options)Adds a new interface endpoint to this VPC.
addVpnConnection(id, options)Adds a new VPN connection to this VPC.
applyRemovalPolicy(policy)Apply the given removal policy to this resource.
enableVpnGateway(options)Adds a VPN Gateway to this VPC.
selectSubnets(selection?)Return information on the subnets appropriate for the given selection strategy.

addClientVpnEndpoint(id, options)

public addClientVpnEndpoint(id: string, options: ClientVpnEndpointOptions): ClientVpnEndpoint

Parameters

  • id string
  • options ClientVpnEndpointOptions

Returns

  • ClientVpnEndpoint

Adds a new client VPN endpoint to this VPC.


addFlowLog(id, options?)

public addFlowLog(id: string, options?: FlowLogOptions): FlowLog

Parameters

  • id string
  • options FlowLogOptions

Returns

  • FlowLog

Adds a new Flow Log to this VPC.


addGatewayEndpoint(id, options)

public addGatewayEndpoint(id: string, options: GatewayVpcEndpointOptions): GatewayVpcEndpoint

Parameters

  • id string
  • options GatewayVpcEndpointOptions

Returns

  • GatewayVpcEndpoint

Adds a new gateway endpoint to this VPC.


addInterfaceEndpoint(id, options)

public addInterfaceEndpoint(id: string, options: InterfaceVpcEndpointOptions): InterfaceVpcEndpoint

Parameters

  • id string
  • options InterfaceVpcEndpointOptions

Returns

  • InterfaceVpcEndpoint

Adds a new interface endpoint to this VPC.


addVpnConnection(id, options)

public addVpnConnection(id: string, options: VpnConnectionOptions): VpnConnection

Parameters

  • id string
  • options VpnConnectionOptions

Returns

  • VpnConnection

Adds a new VPN connection to this VPC.


applyRemovalPolicy(policy)

public applyRemovalPolicy(policy: RemovalPolicy): void

Parameters

  • policy RemovalPolicy

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)

public enableVpnGateway(options: EnableVpnGatewayOptions): void

Parameters

  • options EnableVpnGatewayOptions

Adds a VPN Gateway to this VPC.


selectSubnets(selection?)

public selectSubnets(selection?: SubnetSelection): SelectedSubnets

Parameters

  • selection SubnetSelection

Returns

  • 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.