Get your Zookeeper connection string

There will be times when you need your Zookeeper connection string such as using various kafka utilities. This string will be a list of hostnames and ports that the application will use to connect to Zookeeper and gather required data.

It is strongly reccomended you do not modify or reuse the provided Zookeeper servers in any way. The connection provided is for applications to gather data about the cluster. Modifying the contents of Zookeeper directly can cause cluster failure and data loss.

Using the AWS Console

  1. Open the Amazon MSK console at

  2. Click on the name of the cluster you want the details for

  1. Click on View client information in the Cluster summary section

  1. Click the copy button in the ZooKeeper connect section

Using the AWS CLI

  1. Get your ClusterARN

  2. Connect to your KafkaClientInstance via SSH in Cloud9

  3. Use the CLI to describe the cluster with the ARN gathered in the previous step - this will output the ZookeeperConnectString:

     cd ~/kafka/bin
     aws kafka describe-cluster --cluster-arn $CLUSTER_ARN --output json | jq ".ClusterInfo.ZookeeperConnectString"


If you’re working on the command line, and to save yourself some work, put your ZooKeeper connection string into an envrionment variable:

    export MYZK="zkhost1:2181,zkhost2:2181,zkhost3:2181"

or simply:

    export MYZK=$(aws kafka describe-cluster --cluster-arn $CLUSTER_ARN --output json | jq ".ClusterInfo.ZookeeperConnectString" | tr -d \")

Then you can refer to the variable in later commands:

    $ bin/ --zookeeper $MYZK --list