MSK List Topics and Reboot Broker using Python boto3 API

210 Views Asked by At

I am trying to do 2 things.

  1. List MSK topics using python boto3 API, but am unable to find an API in boto3.client("kafka")
  2. Also, I am trying to reboot broker using the same python boto3 API.

  • I am able to do this by invoking a python module that contains code to invoke the aforementioned API and reboot the broker successfully - VIA Command Line

  • I am unable to have this executed via a lambda function with the same python module deployed as code and times out every time.

  • After some investigation, it was learned that the MSK API service resides in a different VPC than that of the lambda's and hence the communication was not being established.

    Therefore, tried the API gateway route by using a VPC endpoint with execute-api enabled, and the lambda this time tied to the API gateway.
    We still ended up in the same state where we started - the calls were timing out.

How could I be helped -

  • If there are any pointers to boto3 API with list topics method, please share.
  • If there is a way to invoke reboot broker from a lambda function, that would be greatly appreciated if shared.
  • Any thoughts on the above scenarios or if you're aware of any limitations about the way reboot broker or list topics or any MSK API service's accessibility, please let me know and I shall take a pause in this direction until there's a further update. Because, I think I have spent days on this already.

Thank you, in advance.

1

There are 1 best solutions below

2
On

boto3 API with list topics method

There wouldn't be any. You'd use a Python Kafka client, pointed at MSK bootstrap-servers, then construct an AdminClient

way to invoke reboot broker from a lambda function

You would have to reboot the EC2 server, rather than use a Kafka API