Skip to content

Commit 67539de

Browse files
authored
feat(msk-alpha): support Kafka 4.1 (#35759)
### Issue # (if applicable) N/A ### Reason for this change To support new Kafka version. [Amazon MSK adds support for Apache Kafka version 4.1 ](https://aws.amazon.com/about-aws/whats-new/2025/10/amazon-msk-apache-kafka-version-4-1/) ### Description of changes Added ver 4.1 enum. ### Describe any new or updated permissions being added N/A ### Description of how you validated changes Add a unit test and an integ test. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 3437272 commit 67539de

File tree

11 files changed

+590
-1365
lines changed

11 files changed

+590
-1365
lines changed

packages/@aws-cdk/aws-msk-alpha/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ The following example creates an MSK Cluster.
2323
declare const vpc: ec2.Vpc;
2424
const cluster = new msk.Cluster(this, 'Cluster', {
2525
clusterName: 'myCluster',
26-
kafkaVersion: msk.KafkaVersion.V4_0_X_KRAFT,
26+
kafkaVersion: msk.KafkaVersion.V4_1_X_KRAFT,
2727
vpc,
2828
});
2929
```
@@ -36,7 +36,7 @@ To control who can access the Cluster, use the `.connections` attribute. For a l
3636
declare const vpc: ec2.Vpc;
3737
const cluster = new msk.Cluster(this, 'Cluster', {
3838
clusterName: 'myCluster',
39-
kafkaVersion: msk.KafkaVersion.V4_0_X_KRAFT,
39+
kafkaVersion: msk.KafkaVersion.V4_1_X_KRAFT,
4040
vpc,
4141
});
4242

@@ -88,7 +88,7 @@ import * as acmpca from 'aws-cdk-lib/aws-acmpca';
8888
declare const vpc: ec2.Vpc;
8989
const cluster = new msk.Cluster(this, 'Cluster', {
9090
clusterName: 'myCluster',
91-
kafkaVersion: msk.KafkaVersion.V4_0_X_KRAFT,
91+
kafkaVersion: msk.KafkaVersion.V4_1_X_KRAFT,
9292
vpc,
9393
encryptionInTransit: {
9494
clientBroker: msk.ClientBrokerEncryption.TLS,
@@ -113,7 +113,7 @@ Enable client authentication with [SASL/SCRAM](https://docs.aws.amazon.com/msk/l
113113
declare const vpc: ec2.Vpc;
114114
const cluster = new msk.Cluster(this, 'cluster', {
115115
clusterName: 'myCluster',
116-
kafkaVersion: msk.KafkaVersion.V4_0_X_KRAFT,
116+
kafkaVersion: msk.KafkaVersion.V4_1_X_KRAFT,
117117
vpc,
118118
encryptionInTransit: {
119119
clientBroker: msk.ClientBrokerEncryption.TLS,
@@ -132,7 +132,7 @@ Enable client authentication with [IAM](https://docs.aws.amazon.com/msk/latest/d
132132
declare const vpc: ec2.Vpc;
133133
const cluster = new msk.Cluster(this, 'cluster', {
134134
clusterName: 'myCluster',
135-
kafkaVersion: msk.KafkaVersion.V4_0_X_KRAFT,
135+
kafkaVersion: msk.KafkaVersion.V4_1_X_KRAFT,
136136
vpc,
137137
encryptionInTransit: {
138138
clientBroker: msk.ClientBrokerEncryption.TLS,
@@ -155,7 +155,7 @@ import * as acmpca from 'aws-cdk-lib/aws-acmpca';
155155
declare const vpc: ec2.Vpc;
156156
const cluster = new msk.Cluster(this, 'Cluster', {
157157
clusterName: 'myCluster',
158-
kafkaVersion: msk.KafkaVersion.V4_0_X_KRAFT,
158+
kafkaVersion: msk.KafkaVersion.V4_1_X_KRAFT,
159159
vpc,
160160
encryptionInTransit: {
161161
clientBroker: msk.ClientBrokerEncryption.TLS,
@@ -186,7 +186,7 @@ declare const vpc: ec2.Vpc;
186186
declare const bucket: s3.IBucket;
187187
const cluster = new msk.Cluster(this, 'cluster', {
188188
clusterName: 'myCluster',
189-
kafkaVersion: msk.KafkaVersion.V4_0_X_KRAFT,
189+
kafkaVersion: msk.KafkaVersion.V4_1_X_KRAFT,
190190
vpc,
191191
logging: {
192192
s3: {
@@ -226,7 +226,7 @@ declare const bucket: s3.IBucket;
226226

227227
const cluster = new msk.Cluster(this, 'cluster', {
228228
clusterName: 'myCluster',
229-
kafkaVersion: msk.KafkaVersion.V4_0_X_KRAFT,
229+
kafkaVersion: msk.KafkaVersion.V4_1_X_KRAFT,
230230
vpc,
231231
storageMode: msk.StorageMode.TIERED,
232232
});

packages/@aws-cdk/aws-msk-alpha/lib/cluster-version.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,13 @@ export class KafkaVersion {
232232
*/
233233
public static readonly V4_0_X_KRAFT = KafkaVersion.of('4.0.x.kraft', { tieredStorage: true });
234234

235+
/**
236+
* Kafka version 4.1.x with KRaft (Apache Kafka Raft) metadata mode support
237+
*
238+
* @see https://docs.aws.amazon.com/msk/latest/developerguide/metadata-management.html#kraft-intro
239+
*/
240+
public static readonly V4_1_X_KRAFT = KafkaVersion.of('4.1.x.kraft', { tieredStorage: true });
241+
235242
/**
236243
* Custom cluster version
237244
* @param version custom version number

packages/@aws-cdk/aws-msk-alpha/test/cluster.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ describe('MSK Cluster', () => {
5252
[msk.KafkaVersion.V3_9_X, '3.9.x'],
5353
[msk.KafkaVersion.V3_9_X_KRAFT, '3.9.x.kraft'],
5454
[msk.KafkaVersion.V4_0_X_KRAFT, '4.0.x.kraft'],
55+
[msk.KafkaVersion.V4_1_X_KRAFT, '4.1.x.kraft'],
5556
],
5657
)('created with expected Kafka version %j', (parameter, result) => {
5758
new msk.Cluster(stack, 'Cluster', {

packages/@aws-cdk/aws-msk-alpha/test/integ.cluster-version.js.snapshot/KafkaVersionIntegTestDefaultTestDeployAssertD6628743.assets.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk/aws-msk-alpha/test/integ.cluster-version.js.snapshot/KafkaVersionTestStack.assets.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)