Class CfnVPCCidrBlock

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

@Generated(value="jsii-pacmak/1.104.0 (build e79254c)", date="2024-11-22T02:24:00.522Z") @Stability(Stable) public class CfnVPCCidrBlock extends CfnResource implements IInspectable
Associates a CIDR block with your VPC.

You can optionally request an IPv6 CIDR block for the VPC. You can request an Amazon-provided IPv6 CIDR block from Amazon's pool of IPv6 addresses, or an IPv6 CIDR block from an IPv6 address pool that you provisioned through bring your own IP addresses (BYOIP).

For more information, see VPC CIDR blocks in the Amazon VPC User Guide .

Example:

 Vpc vpc;
 public void associateSubnetWithV6Cidr(Vpc vpc, Number count, ISubnet subnet) {
     CfnSubnet cfnSubnet = (CfnSubnet)subnet.getNode().getDefaultChild();
     cfnSubnet.getIpv6CidrBlock() = Fn.select(count, Fn.cidr(Fn.select(0, vpc.getVpcIpv6CidrBlocks()), 256, (128 - 64).toString()));
     cfnSubnet.getAssignIpv6AddressOnCreation() = true;
 }
 // make an ipv6 cidr
 CfnVPCCidrBlock ipv6cidr = CfnVPCCidrBlock.Builder.create(this, "CIDR6")
         .vpcId(vpc.getVpcId())
         .amazonProvidedIpv6CidrBlock(true)
         .build();
 // connect the ipv6 cidr to all vpc subnets
 Number subnetcount = 0;
 ISubnet[] subnets = vpc.publicSubnets.concat(vpc.getPrivateSubnets());
 for (Object subnet : subnets) {
     // Wait for the ipv6 cidr to complete
     subnet.node.addDependency(ipv6cidr);
     associateSubnetWithV6Cidr(vpc, subnetcount, subnet);
     subnetcount = subnetcount + 1;
 }
 Cluster cluster = Cluster.Builder.create(this, "hello-eks")
         .version(KubernetesVersion.V1_31)
         .vpc(vpc)
         .ipFamily(IpFamily.IP_V6)
         .vpcSubnets(List.of(SubnetSelection.builder().subnets(vpc.getPublicSubnets()).build()))
         .build();
 

See Also:
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String CFN_RESOURCE_TYPE_NAME
      The CloudFormation resource type name for this resource class.
  • Constructor Details

    • CfnVPCCidrBlock

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

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

      @Stability(Stable) public CfnVPCCidrBlock(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnVPCCidrBlockProps props)
      Parameters:
      scope - Scope in which this resource is defined. This parameter is required.
      id - Construct identifier for this resource (unique in its scope). This parameter is required.
      props - Resource properties. This parameter is required.
  • Method Details

    • inspect

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      Parameters:
      inspector - tree inspector to collect and process attributes. This parameter is required.
    • renderProperties

      @Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
      Overrides:
      renderProperties in class CfnResource
      Parameters:
      props - This parameter is required.
    • getAttrId

      @Stability(Stable) @NotNull public String getAttrId()
      The Id of the VPC associated CIDR Block.
    • getAttrIpSource

      @Stability(Stable) @NotNull public String getAttrIpSource()
      The source that allocated the IP address space.

      byoip or amazon indicates public IP address space allocated by Amazon or space that you have allocated with Bring your own IP (BYOIP). none indicates private space.

    • getAttrIpv6AddressAttribute

      @Stability(Stable) @NotNull public String getAttrIpv6AddressAttribute()
      Public IPv6 addresses are those advertised on the internet from AWS .

      Private IP addresses are not and cannot be advertised on the internet from AWS .

    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getVpcId

      @Stability(Stable) @NotNull public String getVpcId()
      The ID of the VPC.
    • setVpcId

      @Stability(Stable) public void setVpcId(@NotNull String value)
      The ID of the VPC.
    • getAmazonProvidedIpv6CidrBlock

      @Stability(Stable) @Nullable public Object getAmazonProvidedIpv6CidrBlock()
      Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC.
    • setAmazonProvidedIpv6CidrBlock

      @Stability(Stable) public void setAmazonProvidedIpv6CidrBlock(@Nullable Boolean value)
      Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC.
    • setAmazonProvidedIpv6CidrBlock

      @Stability(Stable) public void setAmazonProvidedIpv6CidrBlock(@Nullable IResolvable value)
      Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC.
    • getCidrBlock

      @Stability(Stable) @Nullable public String getCidrBlock()
      An IPv4 CIDR block to associate with the VPC.
    • setCidrBlock

      @Stability(Stable) public void setCidrBlock(@Nullable String value)
      An IPv4 CIDR block to associate with the VPC.
    • getIpv4IpamPoolId

      @Stability(Stable) @Nullable public String getIpv4IpamPoolId()
      Associate a CIDR allocated from an IPv4 IPAM pool to a VPC.
    • setIpv4IpamPoolId

      @Stability(Stable) public void setIpv4IpamPoolId(@Nullable String value)
      Associate a CIDR allocated from an IPv4 IPAM pool to a VPC.
    • getIpv4NetmaskLength

      @Stability(Stable) @Nullable public Number getIpv4NetmaskLength()
      The netmask length of the IPv4 CIDR you would like to associate from an Amazon VPC IP Address Manager (IPAM) pool.
    • setIpv4NetmaskLength

      @Stability(Stable) public void setIpv4NetmaskLength(@Nullable Number value)
      The netmask length of the IPv4 CIDR you would like to associate from an Amazon VPC IP Address Manager (IPAM) pool.
    • getIpv6CidrBlock

      @Stability(Stable) @Nullable public String getIpv6CidrBlock()
      An IPv6 CIDR block from the IPv6 address pool.

      You must also specify Ipv6Pool in the request.

    • setIpv6CidrBlock

      @Stability(Stable) public void setIpv6CidrBlock(@Nullable String value)
      An IPv6 CIDR block from the IPv6 address pool.

      You must also specify Ipv6Pool in the request.

    • getIpv6IpamPoolId

      @Stability(Stable) @Nullable public String getIpv6IpamPoolId()
      Associates a CIDR allocated from an IPv6 IPAM pool to a VPC.
    • setIpv6IpamPoolId

      @Stability(Stable) public void setIpv6IpamPoolId(@Nullable String value)
      Associates a CIDR allocated from an IPv6 IPAM pool to a VPC.
    • getIpv6NetmaskLength

      @Stability(Stable) @Nullable public Number getIpv6NetmaskLength()
      The netmask length of the IPv6 CIDR you would like to associate from an Amazon VPC IP Address Manager (IPAM) pool.
    • setIpv6NetmaskLength

      @Stability(Stable) public void setIpv6NetmaskLength(@Nullable Number value)
      The netmask length of the IPv6 CIDR you would like to associate from an Amazon VPC IP Address Manager (IPAM) pool.
    • getIpv6Pool

      @Stability(Stable) @Nullable public String getIpv6Pool()
      The ID of an IPv6 address pool from which to allocate the IPv6 CIDR block.
    • setIpv6Pool

      @Stability(Stable) public void setIpv6Pool(@Nullable String value)
      The ID of an IPv6 address pool from which to allocate the IPv6 CIDR block.