Skip to content

msk: CDK doesn't allow a cluster with multiple authentication methods #16980

@nlongton

Description

@nlongton

General Issue

We want to use IAM auth but this is only for Java so we also need TLS for python etc.

The Question

We want to use IAM auth but this is only for Java so we also need TLS for python etc.
When i use the AWS Console to create a MSK cluster I can select none, TLS and IAM and get multiple connection string. eg:

TLS:
b-1..$$$$.kafka.us-west-2.amazonaws.com:9094,b-2..$$$$.kafka.us-west-2.amazonaws.com:9094
IAM:
b-1..$$$$.kafka.us-west-2.amazonaws.com:9098,b-2..$$$$.kafka.us-west-2.amazonaws.com:9098
Plaintext:
b-1..$$$$.kafka.us-west-2.amazonaws.com:9092,b-2..$$$$.kafka.us-west-2.amazonaws.com:9092

However the logic in the cluster.ts prevents creating a dual TLS and IAM credential properties class, and even if it did then this logic only acts on one type

let clientAuthentication;
if (props.clientAuthentication?.saslProps?.iam) {
  clientAuthentication = {
    sasl: { iam: { enabled: props.clientAuthentication.saslProps.iam } },
  };
} else if (props.clientAuthentication?.saslProps?.scram) {
  clientAuthentication = {
    sasl: {
      scram: {
        enabled: props.clientAuthentication.saslProps.scram,
      },
    },
  };
} else if (
  props.clientAuthentication?.tlsProps?.certificateAuthorities !== undefined
) {
  clientAuthentication = {
    tls: {
      certificateAuthorityArnList: props.clientAuthentication?.tlsProps?.certificateAuthorities.map(
        (ca) => ca.certificateAuthorityArn,
      ),
    },
  };
}

Is this constraint imposed by the SDK - havent had time to look there - and how does the console manage it?

CDK CLI Version

1.123.0

Framework Version

1.127.0

Node.js Version

14.17.0

OS

any

Language

Typescript

Language Version

3.9.7

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-mskRelated to Amazon Managed Streaming for Apache Kafka (Amazon MSK)effort/smallSmall work item – less than a day of effortfeature-requestA feature should be added or improved.p2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions