How to Use Kafka Tools With Confluent Cloud

There are times when you may want to use one of the CLI tools that Apache Kafka® provides with your Confluent Cloud cluster.

You can do this by creating a configuration file that contains basic connectivity details such as the bootstrap server and a cluster API key and secret. You can use this file with any Kafka tool that accepts a configuration file. Some of the tools that provide a configuration option, and the option to specify the configuration file are listed in the table that follows:

Kafka Tool Config property option command-config consumer.config producer.config command-config

Note that you might not be able to use every Kafka tool with every Confluent Cloud cluster type.


If you install Confluent Platform, you can use all of the Kafka CLI tools in the $CONFLUENT_HOME/bin folder in the same way as the CLI tools that install with Kafka. Confluent has dropped the .sh extension, so you don’t need this when you call the Confluent versions of these tools. For more information, see CLI Tools for Confluent Platform.

Create a configuration file

  1. Create a file named and save it in a secure location. You will populate this file with credentials to access your Confluent Cloud account so you must keep it in a safe place. Add the following content to the file:

    bootstrap.servers=<cloud-bootstrap-server> required username="<cloud-key>" password="<cloud-password>";

Next, you will populate the file with your Confluent Cloud cluster information:

  1. Sign in to your Confluent Cloud account.

  2. In the Cloud Console, navigate to the cluster you want to work with.

  3. Navigate to the Cluster Settings page and copy the Bootstrap server to the bootstrap server entry in the config file. You also should save the bootstrap server for use with the Kafka tools.

  4. Next, create an API key and add the key and password to the configuration file. In the Cloud Console, navigate to API Keys, Add key and copy the key to the Username field, and the secret to the Password field in the config file and save the file. For more about how to create a API key for your cluster, including with the Confluent CLI, see Create a resource API key.

Call the tool

After you have set up the configuration file that references your cluster, you can use it with some of the Kafka tools. You will also need the bootstrap server of the Confluent Cloud cluster when you call a tool.

The following example shows you how to write messages to a Confluent Cloud cluster topic named test with the kafka-console-producer tool. In this example, the configuration file and bootstrap server are specified as options. Make sure the topic already exists on the cluster.

./bin/ --producer.config ../path/to/secure/ --bootstrap-server --topic test

Now enter some messages at the prompt (>):

> first event message
> second event message

To test your calls, navigate to the Cloud Console, select the topic, and click the Messages tab. You should see the messages you just produced.