Configure dual-stack network type - Amazon Managed Streaming for Apache Kafka
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Configure dual-stack network type

Amazon MSK supports dual-stack network type for existing MSK Serverless clusters that use Kafka version 3.6.0 or later at no additional cost. With dual-stack networking, your clusters can use both IPv4 and IPv6 addresses. Dual-stack endpoints also support IPv4 thus maintaining backward compatibility. Amazon MSK provides IPv6 support through dual-stack network type, not as IPv6-only.

By default, clients connect to Amazon MSK clusters using the IPv4 network type. All new clusters that you create also use IPv4 by default. To update a cluster's network type to dual-stack, make sure you’ve fulfilled the prerequisites described in the following section. Then, use the UpdateConnectivity API to update connectivity to dual-stack.

Note

Once you update your cluster to use the dual-stack network type, you can’t switch it back to the IPv4 network type.

Prerequisites for using dual-stack network type

Before you configure dual-stack network type for your clusters, make sure you that all subnets you provide during cluster creation must support dual-stack network type. If even one subnet in your cluster doesn’t support dual-stack, you won’t be able to update the network type for your cluster to dual-stack.

IAM permissions for MSK Serverless

You must have the following IAM permissions:

  • ec2:DescribeSubnets

  • ec2:ModifyVpcEndpoint

For a complete list of permissions required to perform all Amazon MSK actions, see Amazon managed policy: AmazonMSKFullAccess.

Use dual-stack network type for a cluster

You can update the network type for an MSK Serverless cluster using the Amazon Web Services Management Console, Amazon CLI, or Amazon SDK.

Using Amazon Web Services Management Console
  1. Open the Amazon MSK console at https://console.amazonaws.cn/msk/home?region=us-east-1#/home/.

  2. Choose the MSK Serverless cluster for which you want to configure the dual-stack network type.

  3. On the Cluster details page, choose Properties.

  4. In Network settings, choose Edit network type.

  5. For Network type, choose Dual stack.

  6. Choose Save changes.

Using Amazon CLI

You can use the update-connectivity API to update the network type of your existing MSK Serverless cluster to dual-stack. The following example uses the update-connectivity command to set the cluster’s network type to dual-stack.

In the following example, replace the sample cluster ARN, arn:aws-cn:kafka:us-east-1: 123456789012:cluster/myCluster /12345678-1234-1234-1234-123456789012 -1, with your actual MSK cluster ARN. To get the current cluster version, use the describe-cluster command.

aws kafka update-connectivity \ --cluster-arn "arn:aws-cn:kafka:us-east-1:123456789012:cluster/myCluster/12345678-1234-1234-1234-123456789012-1" \ --current-version "KTVPDKIKX0DER" \ --connectivity-info '{ "networkType": "DUAL" }
Using Amazon SDK

The following example uses the UpdateConnectivity API to set the cluster’s network type to dual-stack.

In the following example, replace the sample cluster ARN, arn:aws-cn:kafka:us-east-1:123456789012:cluster/myCluster/12345678-1234-1234-1234-123456789012-1, with your actual MSK cluster ARN. To get the current cluster version use the DescribeCluster API.

import boto3 client = boto3.client("kafka") response = client.update_connectivity( ClusterArn="arn:aws-cn:kafka:us-east-1:123456789012:cluster/myCluster/12345678-1234-1234-1234-123456789012-1", CurrentVersion="KTVPDKIKX0DER", ConnectivityInfo={ "NetworkType": "DUAL" } ) print("Connectivity update initiated:", response)

Considerations for using dual-stack network type

  • IPv6 support is currently available only in dual-stack mode (IPv4 + IPv6), not as IPv6-only.

  • Dual-stack network type is unavailable for multi-VPC private connectivity.

  • You can change the network type from IPv4 to dual-stack for an existing cluster only if all its subnets support the dual-stack network type.

  • You can't revert to the IPv4 network type after enabling dual-stack. To switch back, you must delete and recreate the cluster.

  • You must have the following IAM permissions:

    • ec2:DescribeSubnets and ec2:ModifyVpcEndpoint