java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.ec2.alpha.VpcV2Base
All Implemented Interfaces:
IResource, IVpcV2, IVpc, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable
Direct Known Subclasses:
VpcV2

@Generated(value="jsii-pacmak/1.103.1 (build bef2dea)", date="2024-10-05T03:43:53.192Z") @Stability(Experimental) public abstract class VpcV2Base extends Resource implements IVpcV2
(experimental) Base class for creating a VPC (Virtual Private Cloud) in AWS.

For more information, see the

invalid @link
{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.Vpc.html
AWS CDK Documentation on VPCs}.
  • Constructor Details

    • VpcV2Base

      protected VpcV2Base(software.amazon.jsii.JsiiObjectRef objRef)
    • VpcV2Base

      protected VpcV2Base(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • VpcV2Base

      @Stability(Stable) protected VpcV2Base(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable ResourceProps props)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props -
    • VpcV2Base

      @Stability(Stable) protected VpcV2Base(@NotNull software.constructs.Construct scope, @NotNull String id)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
  • Method Details

    • addClientVpnEndpoint

      @Stability(Experimental) @NotNull public ClientVpnEndpoint addClientVpnEndpoint(@NotNull String id, @NotNull ClientVpnEndpointOptions options)
      (experimental) Adds a new client VPN endpoint to this VPC.

      Specified by:
      addClientVpnEndpoint in interface IVpc
      Parameters:
      id - This parameter is required.
      options - This parameter is required.
    • addEgressOnlyInternetGateway

      @Stability(Experimental) public void addEgressOnlyInternetGateway(@Nullable EgressOnlyInternetGatewayOptions options)
      (experimental) Adds a new Egress Only Internet Gateway to this VPC and defines a new route to the route table of given subnets.

      Default: - in case of no input subnets, no route is created

      Specified by:
      addEgressOnlyInternetGateway in interface IVpcV2
      Parameters:
      options -
    • addEgressOnlyInternetGateway

      @Stability(Experimental) public void addEgressOnlyInternetGateway()
      (experimental) Adds a new Egress Only Internet Gateway to this VPC and defines a new route to the route table of given subnets.

      Default: - in case of no input subnets, no route is created

      Specified by:
      addEgressOnlyInternetGateway in interface IVpcV2
    • addFlowLog

      @Stability(Experimental) @NotNull public FlowLog addFlowLog(@NotNull String id, @Nullable FlowLogOptions options)
      (experimental) Adds a new flow log to this VPC.

      Specified by:
      addFlowLog in interface IVpc
      Parameters:
      id - This parameter is required.
      options -
    • addFlowLog

      @Stability(Experimental) @NotNull public FlowLog addFlowLog(@NotNull String id)
      (experimental) Adds a new flow log to this VPC.

      Specified by:
      addFlowLog in interface IVpc
      Parameters:
      id - This parameter is required.
    • addGatewayEndpoint

      @Stability(Experimental) @NotNull public GatewayVpcEndpoint addGatewayEndpoint(@NotNull String id, @NotNull GatewayVpcEndpointOptions options)
      (experimental) Adds a new gateway endpoint to this VPC.

      Specified by:
      addGatewayEndpoint in interface IVpc
      Parameters:
      id - This parameter is required.
      options - This parameter is required.
    • addInterfaceEndpoint

      @Stability(Experimental) @NotNull public InterfaceVpcEndpoint addInterfaceEndpoint(@NotNull String id, @NotNull InterfaceVpcEndpointOptions options)
      (experimental) Adds a new interface endpoint to this VPC.

      Specified by:
      addInterfaceEndpoint in interface IVpc
      Parameters:
      id - This parameter is required.
      options - This parameter is required.
    • addInternetGateway

      @Stability(Experimental) public void addInternetGateway(@Nullable InternetGatewayOptions options)
      (experimental) Adds a new Internet Gateway to this VPC.

      Default: - creates a new route for public subnets(with all outbound access) to the Internet Gateway.

      Specified by:
      addInternetGateway in interface IVpcV2
      Parameters:
      options -
    • addInternetGateway

      @Stability(Experimental) public void addInternetGateway()
      (experimental) Adds a new Internet Gateway to this VPC.

      Default: - creates a new route for public subnets(with all outbound access) to the Internet Gateway.

      Specified by:
      addInternetGateway in interface IVpcV2
    • addNatGateway

      @Stability(Experimental) @NotNull public NatGateway addNatGateway(@NotNull NatGatewayOptions options)
      (experimental) Adds a new NAT Gateway to the given subnet of this VPC of given subnets.

      Specified by:
      addNatGateway in interface IVpcV2
      Parameters:
      options - This parameter is required.
    • addVpnConnection

      @Stability(Experimental) @NotNull public VpnConnection addVpnConnection(@NotNull String id, @NotNull VpnConnectionOptions options)
      (experimental) Adds a new VPN connection to this VPC.

      Specified by:
      addVpnConnection in interface IVpc
      Parameters:
      id - This parameter is required.
      options - This parameter is required.
    • enableVpnGateway

      @Stability(Deprecated) @Deprecated public void enableVpnGateway(@NotNull EnableVpnGatewayOptions options)
      Deprecated.
      use enableVpnGatewayV2 for compatibility with VPCV2.Route
      (deprecated) Adds a VPN Gateway to this VPC.

      Specified by:
      enableVpnGateway in interface IVpc
      Parameters:
      options - This parameter is required.
    • enableVpnGatewayV2

      @Stability(Experimental) @NotNull public VPNGatewayV2 enableVpnGatewayV2(@NotNull VPNGatewayV2Options options)
      (experimental) Adds VPNGAtewayV2 to this VPC.

      Specified by:
      enableVpnGatewayV2 in interface IVpcV2
      Parameters:
      options - This parameter is required.
    • selectSubnetObjects

      @Stability(Experimental) @NotNull protected List<ISubnet> selectSubnetObjects(@Nullable SubnetSelection selection)
      (experimental) Return the subnets appropriate for the placement strategy.

      Parameters:
      selection -
    • selectSubnetObjects

      @Stability(Experimental) @NotNull protected List<ISubnet> selectSubnetObjects()
      (experimental) Return the subnets appropriate for the placement strategy.
    • selectSubnets

      @Stability(Experimental) @NotNull public SelectedSubnets selectSubnets(@Nullable SubnetSelection selection)
      (experimental) 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.

      Specified by:
      selectSubnets in interface IVpc
      Parameters:
      selection -
    • selectSubnets

      @Stability(Experimental) @NotNull public SelectedSubnets selectSubnets()
      (experimental) 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.

      Specified by:
      selectSubnets in interface IVpc
    • getAvailabilityZones

      @Stability(Experimental) @NotNull public List<String> getAvailabilityZones()
      (experimental) AZs for this VPC.
      Specified by:
      getAvailabilityZones in interface IVpc
    • getInternetConnectivityEstablished

      @Stability(Experimental) @NotNull public abstract software.constructs.IDependable getInternetConnectivityEstablished()
      (experimental) Dependable that can be depended upon to force internet connectivity established on the VPC.
      Specified by:
      getInternetConnectivityEstablished in interface IVpc
    • getIpv4CidrBlock

      @Stability(Experimental) @NotNull public abstract String getIpv4CidrBlock()
      (experimental) The primary IPv4 CIDR block associated with the VPC.

      Needed in order to validate the vpc range of subnet current prop vpcCidrBlock refers to the token value For more information, see the

      invalid @link
      {@link https://docs.aws.amazon.com/vpc/latest/userguide/vpc-cidr-blocks.html#vpc-sizing-ipv4
      }.
      Specified by:
      getIpv4CidrBlock in interface IVpcV2
    • getIsolatedSubnets

      @Stability(Experimental) @NotNull public abstract List<ISubnet> getIsolatedSubnets()
      (experimental) List of isolated subnets in this VPC.
      Specified by:
      getIsolatedSubnets in interface IVpc
    • getPrivateSubnets

      @Stability(Experimental) @NotNull public List<ISubnet> getPrivateSubnets()
      (experimental) List of private subnets in this VPC.
      Specified by:
      getPrivateSubnets in interface IVpc
    • getPublicSubnets

      @Stability(Experimental) @NotNull public List<ISubnet> getPublicSubnets()
      (experimental) List of public subnets in this VPC.
      Specified by:
      getPublicSubnets in interface IVpc
    • getSecondaryCidrBlock

      @Stability(Experimental) @NotNull public abstract List<CfnVPCCidrBlock> getSecondaryCidrBlock()
      (experimental) Secondary IPs for the VPC, can be multiple Ipv4 or Ipv6 Ipv4 should be within RFC#1918 range.
      Specified by:
      getSecondaryCidrBlock in interface IVpcV2
    • getVpcArn

      @Stability(Experimental) @NotNull public abstract String getVpcArn()
      (experimental) Arn of this VPC.
      Specified by:
      getVpcArn in interface IVpc
    • getVpcCidrBlock

      @Stability(Experimental) @NotNull public abstract String getVpcCidrBlock()
      (experimental) CIDR range for this VPC.
      Specified by:
      getVpcCidrBlock in interface IVpc
    • getVpcId

      @Stability(Experimental) @NotNull public abstract String getVpcId()
      (experimental) Identifier for this VPC.
      Specified by:
      getVpcId in interface IVpc
    • getInternetGatewayId

      @Stability(Experimental) @Nullable public String getInternetGatewayId()
      (experimental) Returns the id of the Internet Gateway (if enabled).
    • getVpnGatewayId

      @Stability(Experimental) @Nullable public String getVpnGatewayId()
      (experimental) Returns the id of the VPN Gateway (if enabled).
      Specified by:
      getVpnGatewayId in interface IVpc
    • getIncompleteSubnetDefinition

      @Stability(Experimental) @NotNull protected Boolean getIncompleteSubnetDefinition()
      (experimental) If this is set to true, don't error out on trying to select subnets.
    • setIncompleteSubnetDefinition

      @Stability(Experimental) protected void setIncompleteSubnetDefinition(@NotNull Boolean value)
      (experimental) If this is set to true, don't error out on trying to select subnets.