enum IpFamily
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.EKS.IpFamily |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awseks#IpFamily |
Java | software.amazon.awscdk.services.eks.IpFamily |
Python | aws_cdk.aws_eks.IpFamily |
TypeScript (source) | aws-cdk-lib » aws_eks » IpFamily |
EKS cluster IP family.
Example
declare const vpc: ec2.Vpc;
function associateSubnetWithV6Cidr(vpc: ec2.Vpc, count: number, subnet: ec2.ISubnet) {
const cfnSubnet = subnet.node.defaultChild as ec2.CfnSubnet;
cfnSubnet.ipv6CidrBlock = Fn.select(count, Fn.cidr(Fn.select(0, vpc.vpcIpv6CidrBlocks), 256, (128 - 64).toString()));
cfnSubnet.assignIpv6AddressOnCreation = true;
}
// make an ipv6 cidr
const ipv6cidr = new ec2.CfnVPCCidrBlock(this, 'CIDR6', {
vpcId: vpc.vpcId,
amazonProvidedIpv6CidrBlock: true,
});
// connect the ipv6 cidr to all vpc subnets
let subnetcount = 0;
const subnets = vpc.publicSubnets.concat(vpc.privateSubnets);
for (let subnet of subnets) {
// Wait for the ipv6 cidr to complete
subnet.node.addDependency(ipv6cidr);
associateSubnetWithV6Cidr(vpc, subnetcount, subnet);
subnetcount = subnetcount + 1;
}
const cluster = new eks.Cluster(this, 'hello-eks', {
version: eks.KubernetesVersion.V1_31,
vpc: vpc,
ipFamily: eks.IpFamily.IP_V6,
vpcSubnets: [{ subnets: vpc.publicSubnets }],
});
Members
Name | Description |
---|---|
IP_V4 | Use IPv4 for pods and services in your cluster. |
IP_V6 | Use IPv6 for pods and services in your cluster. |
IP_V4
Use IPv4 for pods and services in your cluster.
IP_V6
Use IPv6 for pods and services in your cluster.