Use AWS Identity and (IAM) to connect to Amazon Managed Streaming
...It allows JVM-based Apache Kafka clients to use AWS IAM for authentication and authorization against Amazon MSK clusters that have AWS IAM enabled as an authentication mechanism. This library provides a new Simple Authentication and Security Layer (SASL) mechanism called AWS_MSK_IAM. This new SASL mechanism can be used by Kafka clients to authenticate against Amazon MSK clusters using AWS IAM. After you've downloaded the code from GitHub, you can build it using Gradle. An uber jar containing the library and all its relocated dependencies except the kafka client and slf4j-api can also be built. ...