IpFamily

class aws_cdk.aws_eks.IpFamily(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

EKS cluster IP family.

ExampleMetadata:

infused

Example:

# vpc: ec2.Vpc


def associate_subnet_with_v6_cidr(self, vpc, count, subnet):
    cfn_subnet = subnet.node.default_child
    cfn_subnet.ipv6_cidr_block = Fn.select(count, Fn.cidr(Fn.select(0, vpc.vpc_ipv6_cidr_blocks), 256, (128 - 64).to_string()))
    cfn_subnet.assign_ipv6_address_on_creation = True

# make an ipv6 cidr
ipv6cidr = ec2.CfnVPCCidrBlock(self, "CIDR6",
    vpc_id=vpc.vpc_id,
    amazon_provided_ipv6_cidr_block=True
)

# connect the ipv6 cidr to all vpc subnets
subnetcount = 0
subnets = vpc.public_subnets.concat(vpc.private_subnets)
for subnet in subnets:
    # Wait for the ipv6 cidr to complete
    subnet.node.add_dependency(ipv6cidr)
    associate_subnet_with_v6_cidr(vpc, subnetcount, subnet)
    subnetcount = subnetcount + 1

cluster = eks.Cluster(self, "hello-eks",
    version=eks.KubernetesVersion.V1_31,
    vpc=vpc,
    ip_family=eks.IpFamily.IP_V6,
    vpc_subnets=[ec2.SubnetSelection(subnets=vpc.public_subnets)]
)

Attributes

IP_V4

Use IPv4 for pods and services in your cluster.

IP_V6

Use IPv6 for pods and services in your cluster.