How to connect from spring boot kafka project to aws MSK

Viewed 6548

I am trying to connect to a aws msk cluster from spring boot kafka app.

i have aws msk arn ,boot strap server config available.

How to integrate in the application? Any examples

Can i run it from local,i mean connect to AWS MSK from local app instance

msk cluster

2 Answers

Connection to AWS MSK is like connecting to any Kafka cluster.

It depends on how you had setup your MSK ? (VPC - Subnet) Check whether you can access from your local or need to be on VPN.

Also see how your brokers endpoints are configured and exposed - Ex:

  • Plaintext (broker:9092)
  • TLS (broker:9094)

If its plaintext, its as simple as setting bootstrap.servers.

Otherwise, you need to add below mentioned properties to access your MSK cluster.

security.protocol: SSL
ssl.truststore.location: jks
ssl.truststore.password: pwd

Please let me know if you still have questions.

If you can connect from kafka-console-* commands (or simpler, kafkacat) then you should be able to connect from any other application.

I suggest you debug using those tools before running anything else.

Related