# IpFamily

EKS cluster IP family.

- Source: [`aws-eks/lib/cluster.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-eks/lib/cluster.ts#L1166)
- Type last changed: v2.84.0 · 14 Jun 2023

## Example

```ts
import { KubectlV36Layer } from '@aws-cdk/lambda-layer-kubectl-v36';
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_36,
  vpc: vpc,
  ipFamily: eks.IpFamily.IP_V6,
  vpcSubnets: [{ subnets: vpc.publicSubnets }],
  kubectlLayer: new KubectlV36Layer(this, 'kubectl'),
});
```

## Members

| Member | Description |
| --- | --- |
| `IP_V4` | Use IPv4 for pods and services in your cluster. |
| `IP_V6` | Use IPv6 for pods and services in your cluster. |

## Referenced by

- [`Cluster`](/v2/docs/aws-cdk-lib.aws_eks.Cluster).ipFamily
- [`ClusterAttributes`](/v2/docs/aws-cdk-lib.aws_eks.ClusterAttributes).ipFamily
- [`ClusterOptions`](/v2/docs/aws-cdk-lib.aws_eks.ClusterOptions).ipFamily
- [`ICluster`](/v2/docs/aws-cdk-lib.aws_eks.ICluster).ipFamily
