There will be times when you need your broker connection string such as connecting producers and consumers as well as some utilies. This may be called your broker list
, seedbroker list
, or bootstrap servers
depending on the tool or application you’re using.
Open the Amazon MSK console at https://console.aws.amazon.com/msk/
Click on the name of the cluster you want the details for
Note:
If you are running an MSK cluster with TLS and Plaintext enabled, you will see two sets of server lists. Ensure you use the correct list for your use case.
Notice that there are two different ports on the same broker - 9092
is the PLAINTEXT port, and 9094
is the TLS port.
Ensure that you have setup the AWS CLI
Get the cluster ARN
Use the command line to run the get-bootstrap-brokers
subcommand
$ aws kafka get-bootstrap-brokers --cluster-arn arn:aws:kafka:us-east-1:xyz:cluster/MSKCluster/0546f493-019f-475a-9903-272f0371ce19-6 --output text
b-1.mskcluster.xyz.c6.kafka.us-east-1.amazonaws.com:9094,b-5.mskcluster.xyz.c6.kafka.us-east-1.amazonaws.com:9094,b-3.mskcluster.xyz.c6.kafka.us-east-1.amazonaws.com:9094
If you’re working on the command line, and to save yourself some work, put your broker connection string into an envrionment variable:
$ export MYBROKERS="broker1:9092,broker2:9092,broker3:9092"
or simply
export MYBROKERS=$(aws kafka get-bootstrap-brokers --cluster-arn arn:aws:kafka:us-east-1:xyz:cluster/MSKCluster/0546f493-019f-475a-9903-272f0371ce19-6 --output text)
Then you can refer to the variable in later commands:
$ bin/kafka-console-consumer.sh --bootstrap-server $MYBROKERS --topic test
You can also build this in to your shell profile to save you work every time you login.