Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

msk: add bootstrapBrokersSaslIam #18355

Closed
2 tasks
jfpolly opened this issue Jan 11, 2022 · 3 comments · Fixed by #21798
Closed
2 tasks

msk: add bootstrapBrokersSaslIam #18355

jfpolly opened this issue Jan 11, 2022 · 3 comments · Fixed by #21798
Labels
@aws-cdk/aws-msk Related to Amazon Managed Streaming for Apache Kafka (Amazon MSK) effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2

Comments

@jfpolly
Copy link

jfpolly commented Jan 11, 2022

Description

Currently @aws-cdk/aws-msk-alpha package supports:

  • bootstrapBrokers
  • bootstrapBrokersTls
  • bootstrapBrokersSaslScram

Please add support for a new property

  • bootstrapBrokersSaslIAM

Use Case

In the case where the Kafka cluster is configured using Sasl with IAM, e.g.:

new msk.Cluster(this, `${tenantName}KafkaCluster`, {
      clusterName: "MyKafkaCluster",
      kafkaVersion: msk.KafkaVersion.V2_8_1,
      vpc: vpc,
      instanceType: new aws_ec2.InstanceType("t3.small"),
      clientAuthentication: msk.ClientAuthentication.sasl({ iam: true })
    });

It is currently not possible to access the bootstrap brokers directly as a property of the Kafka cluster.

Proposed Solution

The Cluster class of aws-msk-alpha contains a private method _bootstrapBrokers. The other public bootstrapBroker* functions are defined in relation to this function:

    get bootstrapBrokers() {
        return this._bootstrapBrokers('BootstrapBrokerString');
    }
// ...
    get bootstrapBrokersTls() {
        return this._bootstrapBrokers('BootstrapBrokerStringTls');
    }
// ...
    get bootstrapBrokersSaslScram() {
        return this._bootstrapBrokers('BootstrapBrokerStringSaslScram');
    }
// ...

A similar function can be defined for SaslIam:

    get bootstrapBrokersSaslIam() {
        return this._bootstrapBrokers('BootstrapBrokerStringSaslIam');
    }

Other information

When accessing the bootstrap brokers of a cluster configured with property

clientAuthentication: msk.ClientAuthentication.sasl({ iam: true })

One can access the bootstrap brokers from the command line:

aws kafka get-bootstrap-brokers --cluster-arn <ClusterArn>

This will return an object:

{
    "BootstrapBrokerStringSaslIam": "..."
}

Acknowledge

  • I may be able to implement this feature request
  • This feature might incur a breaking change
@jfpolly jfpolly added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Jan 11, 2022
@github-actions github-actions bot added the @aws-cdk/aws-msk Related to Amazon Managed Streaming for Apache Kafka (Amazon MSK) label Jan 11, 2022
@otaviomacedo otaviomacedo added effort/small Small work item – less than a day of effort p2 and removed needs-triage This issue or PR still needs to be triaged. labels Jan 12, 2022
@otaviomacedo otaviomacedo removed their assignment Jan 12, 2022
@epretha
Copy link

epretha commented Apr 22, 2022

Hi @otaviomacedo ,
Can you please confirm if this feature is implemented for msk ?
Because, today when I ran the command
aws kafka get-bootstrap-brokers --cluster-arn <myclusterArn>
it returns nothing.
Though in the AWS Management Console, under "View client information", I could see some broker URLs with the Authentication Type set to IAM.

Thanks.

@svyatogor
Copy link

I just ran today:

aws kafka get-bootstrap-brokers --cluster-arn arn:aws:kafka:eu-central-1:******:cluster/msk/******** --region eu-central-1
{
    "BootstrapBrokerStringSaslIam": "****:9098,*****:9098"
}

@mergify mergify bot closed this as completed in #21798 Aug 29, 2022
mergify bot pushed a commit that referenced this issue Aug 29, 2022
When accessing the bootstrap brokers of a cluster configured with property

`clientAuthentication: msk.ClientAuthentication.sasl({ iam: true })`

One can access the bootstrap brokers from the command line:

`aws kafka get-bootstrap-brokers --cluster-arn <ClusterArn>`

This will return an object:

```
{
    "BootstrapBrokerStringSaslIam": "..."
}
```

This PR adds the ability to access the bootstrap brokers directly as a property of the Kafka cluster. This can now be
done via the `cluster.bootstrapBrokersSaslIam` property.



Fixes #18355

----

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [x] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [x] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

josephedward pushed a commit to josephedward/aws-cdk that referenced this issue Aug 30, 2022
When accessing the bootstrap brokers of a cluster configured with property

`clientAuthentication: msk.ClientAuthentication.sasl({ iam: true })`

One can access the bootstrap brokers from the command line:

`aws kafka get-bootstrap-brokers --cluster-arn <ClusterArn>`

This will return an object:

```
{
    "BootstrapBrokerStringSaslIam": "..."
}
```

This PR adds the ability to access the bootstrap brokers directly as a property of the Kafka cluster. This can now be
done via the `cluster.bootstrapBrokersSaslIam` property.



Fixes aws#18355

----

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [x] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [x] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-msk Related to Amazon Managed Streaming for Apache Kafka (Amazon MSK) effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2
Projects
None yet
4 participants