Class CfnVPCCidrBlock
- All Implemented Interfaces:
IEnvironmentAware,IInspectable,IVPCCidrBlockRef,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
A VPC must have an associated IPv4 CIDR block. You can optionally associate additional IPv4 CIDR blocks with a VPC. You can optionally associate an IPv6 CIDR block with a 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:
import software.amazon.awscdk.cdk.lambdalayer.kubectl.v33.KubectlV33Layer;
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_33)
.vpc(vpc)
.ipFamily(IpFamily.IP_V6)
.vpcSubnets(List.of(SubnetSelection.builder().subnets(vpc.getPublicSubnets()).build()))
.kubectlLayer(new KubectlV33Layer(this, "kubectl"))
.build();
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.services.ec2.IVPCCidrBlockRef
IVPCCidrBlockRef.Jsii$Default, IVPCCidrBlockRef.Jsii$Proxy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe CloudFormation resource type name for this resource class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCfnVPCCidrBlock(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedCfnVPCCidrBlock(software.amazon.jsii.JsiiObjectRef objRef) CfnVPCCidrBlock(software.constructs.Construct scope, String id, CfnVPCCidrBlockProps props) -
Method Summary
Modifier and TypeMethodDescriptionRequests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC.The Id of the VPC associated CIDR Block.The source that allocated the IP address space.Public IPv6 addresses are those advertised on the internet from AWS .An IPv4 CIDR block to associate with the VPC.Associate a CIDR allocated from an IPv4 IPAM pool to a VPC.The netmask length of the IPv4 CIDR you would like to associate from an Amazon VPC IP Address Manager (IPAM) pool.An IPv6 CIDR block from the IPv6 address pool.The name of the location from which we advertise the IPV6 CIDR block.Associates a CIDR allocated from an IPv6 IPAM pool to a VPC.The netmask length of the IPv6 CIDR you would like to associate from an Amazon VPC IP Address Manager (IPAM) pool.The ID of an IPv6 address pool from which to allocate the IPv6 CIDR block.A reference to a VPCCidrBlock resource.getVpcId()The ID of the VPC.voidinspect(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties(Map<String, Object> props) voidRequests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC.voidRequests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC.voidsetCidrBlock(String value) An IPv4 CIDR block to associate with the VPC.voidsetIpv4IpamPoolId(String value) Associate a CIDR allocated from an IPv4 IPAM pool to a VPC.voidsetIpv4NetmaskLength(Number value) The netmask length of the IPv4 CIDR you would like to associate from an Amazon VPC IP Address Manager (IPAM) pool.voidsetIpv6CidrBlock(String value) An IPv6 CIDR block from the IPv6 address pool.voidThe name of the location from which we advertise the IPV6 CIDR block.voidsetIpv6IpamPoolId(String value) Associates a CIDR allocated from an IPv6 IPAM pool to a VPC.voidsetIpv6NetmaskLength(Number value) The netmask length of the IPv6 CIDR you would like to associate from an Amazon VPC IP Address Manager (IPAM) pool.voidsetIpv6Pool(String value) The ID of an IPv6 address pool from which to allocate the IPv6 CIDR block.voidThe ID of the VPC.Methods inherited from class software.amazon.awscdk.CfnResource
addDeletionOverride, addDependency, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getAtt, getCfnOptions, getCfnResourceType, getEnv, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, obtainDependencies, obtainResourceDependencies, removeDependency, replaceDependency, shouldSynthesize, toString, validatePropertiesMethods inherited from class software.amazon.awscdk.CfnRefElement
getRefMethods inherited from class software.amazon.awscdk.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdMethods inherited from class software.constructs.Construct
getNode, isConstructMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.constructs.IConstruct
getNodeMethods inherited from interface software.amazon.awscdk.IEnvironmentAware
getEnvMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
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
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspectin interfaceIInspectable- 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:
renderPropertiesin classCfnResource- Parameters:
props- This parameter is required.
-
getAttrId
The Id of the VPC associated CIDR Block. -
getAttrIpSource
The source that allocated the IP address space.byoiporamazonindicates public IP address space allocated by Amazon or space that you have allocated with Bring your own IP (BYOIP).noneindicates private space. -
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
- Overrides:
getCfnPropertiesin classCfnResource
-
getVpcCidrBlockRef
A reference to a VPCCidrBlock resource.- Specified by:
getVpcCidrBlockRefin interfaceIVPCCidrBlockRef
-
getVpcId
The ID of the VPC. -
setVpcId
The ID of the VPC. -
getAmazonProvidedIpv6CidrBlock
Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC.Returns union: either
BooleanorIResolvable -
setAmazonProvidedIpv6CidrBlock
Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. -
setAmazonProvidedIpv6CidrBlock
Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. -
getCidrBlock
An IPv4 CIDR block to associate with the VPC. -
setCidrBlock
An IPv4 CIDR block to associate with the VPC. -
getIpv4IpamPoolId
Associate a CIDR allocated from an IPv4 IPAM pool to a VPC. -
setIpv4IpamPoolId
Associate a CIDR allocated from an IPv4 IPAM pool to a VPC. -
getIpv4NetmaskLength
The netmask length of the IPv4 CIDR you would like to associate from an Amazon VPC IP Address Manager (IPAM) pool. -
setIpv4NetmaskLength
The netmask length of the IPv4 CIDR you would like to associate from an Amazon VPC IP Address Manager (IPAM) pool. -
getIpv6CidrBlock
An IPv6 CIDR block from the IPv6 address pool.You must also specify
Ipv6Poolin the request. -
setIpv6CidrBlock
An IPv6 CIDR block from the IPv6 address pool.You must also specify
Ipv6Poolin the request. -
getIpv6CidrBlockNetworkBorderGroup
The name of the location from which we advertise the IPV6 CIDR block. -
setIpv6CidrBlockNetworkBorderGroup
The name of the location from which we advertise the IPV6 CIDR block. -
getIpv6IpamPoolId
Associates a CIDR allocated from an IPv6 IPAM pool to a VPC. -
setIpv6IpamPoolId
Associates a CIDR allocated from an IPv6 IPAM pool to a VPC. -
getIpv6NetmaskLength
The netmask length of the IPv6 CIDR you would like to associate from an Amazon VPC IP Address Manager (IPAM) pool. -
setIpv6NetmaskLength
The netmask length of the IPv6 CIDR you would like to associate from an Amazon VPC IP Address Manager (IPAM) pool. -
getIpv6Pool
The ID of an IPv6 address pool from which to allocate the IPv6 CIDR block. -
setIpv6Pool
The ID of an IPv6 address pool from which to allocate the IPv6 CIDR block.
-