Skip to main content

Manage configurations with Apache Kafka® CLI tools

Aiven for Apache Kafka® services are fully manageable and customizable via either advanced configuration flags in the Aiven Console or the Aiven CLI. To guarantee the service stability, direct Apache ZooKeeper™ access isn't available, but our tooling provides you all the options that you need - whether your Apache Kafka version has Apache ZooKeeper™ in it or not.

Some of the configuration changes don't need ZooKeeper access, and therefore you can use the standard client tools shipped with the Apache Kafka® binaries. The example below shows how to create a topic using one of such tools, the

Example: Create a topic with retention time to 30 minutes with

Each topic in Apache Kafka can have a different retention time, defining for the messages' time to live. The Aiven web console and API offer the ability to set the retention time as part of the topic creation or update.

The same can be achieved using the script included in the Apache Kafka binaries with the following steps:

  1. Download the Apache Kafka binaries and unpack the archive

  2. Go to the bin folder containing the Apache Kafka client tools commonly used

  3. Create a Java keystore and truststore for the Aiven for Apache Kafka service where you want to create a topic

  4. Create a client configuration file pointing at the keystore and truststore created at the previous steps

  5. Run the following command to check the connectivity to the Aiven for Apache Kafka service, replacing the <KAFKA_SERVICE_URI> with the URI of the service available in the Aiven Console.

    ./                           \
    --bootstrap-server <KAFKA_SERVICE_URI> \
    --command-config \

    If successful, the above command lists all the available topics

  6. Run the following command to create a topic named new-test-topic with a retention rate of 30 minutes. Use the kafka-topics script for this and set the retention value in milliseconds ((100 * 60) * 30 = 180000).

    ./  \
    --bootstrap-server <KAFKA_SERVICE_URI> \
    --command-config \
    --topic new-test-topic \
    --create \
  7. Run the same command as step 5 to check the topic creation. Optionally you could also run the command with the --describe flag to check the details of your topic and the retention rate.


It is currently not possible to change the configurations for an existing topic via as that requires a connection to ZooKeeper.