java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
All Implemented Interfaces:
IResource, IVpcV2, IVpc, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.104.0 (build e79254c)", date="2024-11-13T21:17:43.058Z") @Stability(Experimental) public class VpcV2 extends VpcV2Base
(experimental) This class provides a foundation for creating and configuring a VPC with advanced features such as IPAM (IP Address Management) and IPv6 support.

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

Example:

 Stack stack = new Stack();
 VpcV2 myVpc = new VpcV2(this, "Vpc");
 RouteTable routeTable = RouteTable.Builder.create(this, "RouteTable")
         .vpc(myVpc)
         .build();
 SubnetV2 subnet = SubnetV2.Builder.create(this, "Subnet")
         .vpc(myVpc)
         .availabilityZone("eu-west-2a")
         .ipv4CidrBlock(new IpCidr("10.0.0.0/24"))
         .subnetType(SubnetType.PUBLIC)
         .build();
 myVpc.addInternetGateway();
 myVpc.addNatGateway(NatGatewayOptions.builder()
         .subnet(subnet)
         .connectivityType(NatConnectivityType.PUBLIC)
         .build());
 
  • Constructor Details

    • VpcV2

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

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

      @Stability(Experimental) public VpcV2(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable VpcV2Props props)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props -
    • VpcV2

      @Stability(Experimental) public VpcV2(@NotNull software.constructs.Construct scope, @NotNull String id)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
  • Method Details

    • fromVpcV2Attributes

      @Stability(Experimental) @NotNull public static IVpcV2 fromVpcV2Attributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull VpcV2Attributes attrs)
      (experimental) Create a VPC from existing attributes.

      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      attrs - This parameter is required.
    • getDnsHostnamesEnabled

      @Stability(Experimental) @NotNull public Boolean getDnsHostnamesEnabled()
      (experimental) Indicates if instances launched in this VPC will have public DNS hostnames.
    • getDnsSupportEnabled

      @Stability(Experimental) @NotNull public Boolean getDnsSupportEnabled()
      (experimental) Indicates if DNS support is enabled for this VPC.
    • getInternetConnectivityEstablished

      @Stability(Experimental) @NotNull public software.constructs.IDependable getInternetConnectivityEstablished()
      (experimental) To define dependency on internet connectivity.
      Specified by:
      getInternetConnectivityEstablished in interface IVpc
      Specified by:
      getInternetConnectivityEstablished in class VpcV2Base
    • getIpAddresses

      @Stability(Experimental) @NotNull public IIpAddresses getIpAddresses()
      (experimental) The provider of ipv4 addresses.
    • getIpv4CidrBlock

      @Stability(Experimental) @NotNull public 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
      Specified by:
      getIpv4CidrBlock in class VpcV2Base
    • getIpv6CidrBlocks

      @Stability(Experimental) @NotNull public List<String> getIpv6CidrBlocks()
      (experimental) The IPv6 CIDR blocks for the VPC.

      See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc.html#aws-resource-ec2-vpc-return-values

    • getIsolatedSubnets

      @Stability(Experimental) @NotNull public List<ISubnet> getIsolatedSubnets()
      (experimental) Isolated Subnets that are part of this VPC.
      Specified by:
      getIsolatedSubnets in interface IVpc
      Specified by:
      getIsolatedSubnets in class VpcV2Base
    • getOwnerAccountId

      @Stability(Experimental) @NotNull public String getOwnerAccountId()
      (experimental) Identifier of the owner for this VPC.
      Specified by:
      getOwnerAccountId in interface IVpcV2
      Specified by:
      getOwnerAccountId in class VpcV2Base
    • getPrivateSubnets

      @Stability(Experimental) @NotNull public List<ISubnet> getPrivateSubnets()
      (experimental) Pbulic Subnets that are part of this VPC.
      Specified by:
      getPrivateSubnets in interface IVpc
      Overrides:
      getPrivateSubnets in class VpcV2Base
    • getPublicSubnets

      @Stability(Experimental) @NotNull public List<ISubnet> getPublicSubnets()
      (experimental) Public Subnets that are part of this VPC.
      Specified by:
      getPublicSubnets in interface IVpc
      Overrides:
      getPublicSubnets in class VpcV2Base
    • getRegion

      @Stability(Experimental) @NotNull public String getRegion()
      (experimental) Region for this VPC.
      Specified by:
      getRegion in interface IVpcV2
      Specified by:
      getRegion in class VpcV2Base
    • getResource

      @Stability(Experimental) @NotNull public CfnVPC getResource()
      (experimental) The AWS CloudFormation resource representing the VPC.
    • getUseIpv6

      @Stability(Experimental) @NotNull public Boolean getUseIpv6()
      (experimental) For validation to define IPv6 subnets, set to true in case of Amazon Provided IPv6 cidr range if true, IPv6 addresses can be attached to the subnets.

      Default: false

    • getVpcArn

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

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

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

      @Stability(Experimental) @Nullable public List<String> getIpv4IpamProvisionedCidrs()
      (experimental) IPv4 CIDR provisioned using IPAM pool Required to check for overlapping CIDRs after provisioning is complete under IPAM.
      Specified by:
      getIpv4IpamProvisionedCidrs in interface IVpcV2
      Specified by:
      getIpv4IpamProvisionedCidrs in class VpcV2Base
    • getSecondaryCidrBlock

      @Stability(Experimental) @Nullable public List<IVPCCidrBlock> getSecondaryCidrBlock()
      (experimental) reference to all secondary blocks attached.
      Specified by:
      getSecondaryCidrBlock in interface IVpcV2
      Specified by:
      getSecondaryCidrBlock in class VpcV2Base