Confluent CLI Overview

The Confluent command-line interface (CLI), confluent, enables developers to manage both Confluent Cloud and Confluent Platform and is source-available under the Confluent Community License (for more details, check out the Announcing the Source Available Confluent CLI blog post). The Confluent CLI is feature-packed to help users go from learning Confluent to building automated workflows.

Get started

To get started, install the latest version of the Confluent CLI (for additional installation options, see the Install Confluent CLI page):

  1. Download and install the latest version in the default directory, ./bin:

    curl -sL --http1.1 | sh -s -- latest
  2. Add the ./bin directory to your $PATH:

    export PATH=$(pwd)/bin:$PATH
  3. Sign up for a free Confluent Cloud account by entering the following command and following the prompts:

    confluent cloud-signup
  4. Start auto complete using the following command:

    confluent shell
  5. Log in to your Confluent Cloud account:

    confluent login


    You can add the --save flag if you want to save your credentials locally. This prevents you from having to enter them again in the future.

  6. Create your first Kafka cluster:

    confluent kafka cluster create <name> --cloud <cloud provider> --region <cloud region>

    For example:

    confluent kafka cluster create dev0 --cloud aws --region us-east-1
  7. Create a topic in the cluster using the cluster ID from the output of the previous step:

    confluent kafka topic create <name> --cluster <cluster ID>

    For example:

    confluent kafka topic create test_topic --cluster <ID of the dev0 cluster>
  8. Create an API key for the cluster:

    confluent api-key create --resource <cluster ID>
  9. Produce messages to your topic:

    confluent kafka topic produce <topic name> --api-key <API key> --api-secret <API secret>

    For example:

    confluent kafka topic produce test_topic --api-key <API key created in the previous step> --api-secret <API secret created in the previous step>

    Once the producer is active, you can type messages, delimiting them with return. When you’re finished producing, exit with Ctrl-C or Ctrl-D.

  10. Read back your produced messages, from the beginning:

    confluent kafka topic consume <topic name> --api-key <API key> --api-secret <API secret> --from-begining

    For example:

    confluent kafka topic consume test_topic --api-key <API key created previously> --api-secret <API secret created previously> --from-begining