Get Started with Confluent CLI

The Confluent CLI (CLI) lets you manage both Confluent Cloud and Confluent Platform. The CLI supports tasks that range from learning Confluent to building automated workflows.

Choose Confluent Cloud or Confluent Platform

The Confluent CLI works with both Confluent Cloud and self-managed deployments.

  • Confluent Cloud is fully managed and fast to deploy.

  • Confluent Platform offers full control, and is ideal for on-premises or custom setups. To use Confluent Cloud, sign up at Confluent Cloud. To use Confluent Platform, download it from the Confluent Platform download page.

The CLI source code is available in the confluentinc/cli repository on GitHub under the Confluent Community License. For more information, see the Announcing the Source Available Confluent CLI blog post.

Prerequisites

The Confluent CLI requires a supported operating system and CPU architecture, a compatible Confluent Platform version for on-premises use, and network access to specific domains. Before you start the Confluent CLI Quick start: Create a cluster and produce and consume messages, review the following requirements.

Operating systems

The Confluent CLI is compatible with the following operating systems and architectures only:

  • macOS with 64-bit Intel chips (Darwin AMD64)

  • macOS with Apple chips (Darwin ARM64)

  • Windows with 64-bit Intel or AMD chips (Microsoft Windows AMD64)

  • Linux with 64-bit Intel or AMD chips (Linux AMD64)

  • Linux with 64-bit ARM chips (Linux ARM64)

  • Alpine with 64-bit Intel or AMD chips (Alpine AMD64)

  • Alpine with 64-bit ARM chips (Alpine ARM64)

Note that on non-Alpine Linux systems, the glibc is dynamically linked when Confluent CLI executes. On all other systems, the dependencies are statically linked.

Confluent Platform versions

  • For the compatible Confluent Platform versions for this version of Confluent CLI, see the compatibility table.

  • The Confluent CLI for Confluent Platform requires that you have the Confluent REST Proxy server for Apache Kafka running. The Confluent REST Proxy server mediates uses the APIs and mediate between the Confluent CLI and your clusters.

    This is not required for the Apache Kafka® tools or “scripts” that come with Kafka and ship with Confluent Platform. These alternatives to the Confluent CLI for Confluent Platform do not require the Confluent REST Proxy service to be running. Therefore, the Confluent Platform tutorials in the documentation sometimes feature Kafka scripts rather than the Confluent CLI commands in order to simplify setup for getting started tasks. For example, the basic Cluster Linking tutorial for Confluent Platform that describes how to Share data across topics uses the Kafka scripts throughout (such as kafka-cluster-links --list to list mirror topics rather than confluent kafka topic list or confluent kafka link list). In such scenarios, running the Confluent CLI commands would fail to work if you did not have the REST Proxy server running.

    (This is also not an issue for the Confluent CLI on Confluent Cloud, which is fully-managed, and integrates with the Confluent Cloud APIs under the hood.)

GNU C Library (glibc)

For Confluent Platform version 7.8 and later and Confluent CLI 4.8+, glibc version 2.28 or higher is required.

Network access

When the Confluent CLI interacts with Confluent Cloud, it requires network access to the following domains:

  • confluent.cloud.

  • login.confluent.io when using SSO.

  • api.stripe.com when using the confluent billing payment commands.

  • s3-us-west-2.amazonaws.com/confluent.cloud when the update check is enabled.

To minimize access to these domains, you can:

Quick start: Create a cluster and produce and consume messages

To get started, install the latest version of the Confluent CLI, create an Apache Kafka® cluster and topic, and produce and consume messages as described below.

  1. Install the latest version of the command-line tool following the instructions for your operating system.

  2. Sign up for a free Confluent Cloud account by entering the following command in your terminal:

    confluent cloud-signup
    

    The browser redirects to the free Confluent Cloud account sign-up page.

  3. After signing up for a free account, start autocomplete by entering the following command:

    confluent shell
    
  4. Using the confluent interactive shell, enter the following command to log in to Confluent Cloud:

    login
    

    If you have not saved your credentials locally, enter them at the following prompts:

    Enter your Confluent Cloud credentials:
    Email:
    Password:
    

    Note

    If you signed up for a free Confluent Cloud account using GitHub or Google credentials, provide your GitHub or Google username and password to sign in. Add the --save flag to save your credentials locally so you don’t need to enter them again.

  5. Create your first Kafka cluster:

    kafka cluster create <name> --cloud <cloud_provider> --region <cloud_region>
    

    For example:

    kafka cluster create dev0 --cloud aws --region us-east-1
    

    The output should resemble the following:

    It may take up to 5 minutes for the Kafka cluster to be ready.
    +-----------------------+----------------------------------------------------------+
    | Current              || false                                                    |
    | ID                   || lkc-dfgrt7                                               |
    | Name                 || dev0                                                     |
    | Type                 || BASIC                                                    |
    | Ingress Limit (MB/s) || 250                                                      |
    | Egress Limit (MB/s)  || 750                                                      |
    | Storage              || 5 TB                                                     |
    | Provider             || aws                                                      |
    | Region               || us-east-1                                                |
    | Availability         || single-zone                                              |
    | Status               || PROVISIONING                                             |
    | Endpoint             || SASL_SSL://xxx-xxxx.us-east-1.aws.confluent.cloud:1234   |
    | REST Endpoint        || https://yyy-y11yy.us-east-1.aws.confluent.cloud:345      |
    +-----------------------+----------------------------------------------------------+
    
  6. Create a topic in the cluster using the cluster ID from the output of the previous step:

    kafka topic create <name> --cluster <cluster_id>
    

    For example:

    kafka topic create test_topic --cluster lkc-dfgrt7
    

    The output confirms that the topic was created:

    Created topic "test_topic".
    
  7. Create an API key for the cluster:

    api-key create --resource lkc-dfgrt7
    

    The output should resemble the following:

    It may take a couple of minutes for the API key to be ready.
    Save the API key and secret. The secret is not retrievable later.
    +-------------+-------------------------------------------------------------------+
    | API Key     | <YOUR API KEY>                                                    |
    | API Secret  | <YOUR API SECRET>                                                 |
    +-------------+-------------------------------------------------------------------+
    
  8. Produce messages to your topic:

    kafka topic produce <topic_name> --api-key <your_api_key> --api-secret <your_api_secret>
    

    For example:

    kafka topic produce test_topic --api-key <your_api_key> --api-secret <your_api_secret>
    

    The output should resemble the following:

    Starting Kafka Producer. Use Ctrl-C or Ctrl-D to exit.
    
  9. After the producer is active, type messages, pressing Enter after each one. For example:

    today
    then
    now
    forever
    
  10. When you’re finished producing, exit with Ctrl+C or Ctrl+D.

  11. Read back the produced messages from the beginning:

    kafka topic consume <topic_name> --api-key <your_api_key> --api-secret <your_api_secret> --from-beginning
    

    For example:

    kafka topic consume test_topic --api-key <your_api_key> --api-secret <your_api_secret> --from-beginning
    

    Based on the messages you entered, the output should resemble the following:

    Starting Kafka Consumer. Use Ctrl-C to exit.
    forever
    now
    today
    then
    

Check for Confluent CLI updates

Important

On Alpine Linux, you can’t directly upgrade from the Confluent CLI versions v2.0.0 through v2.17.1 using the standard confluentupdate command. Running confluent update on those versions on Alpine Linux will result in an updated confluent client that is incompatible with the operating system.

To upgrade from the v2.0.0 through v2.17.1 versions on Alpine Linux, remove your existing confluent client and re-install using the command: curl -sL --http1.1 https://cnfl.io/cli | sh -s -- latest.

confluent v2.17.2 and later can be updated directly with confluentupdate on Alpine Linux.

Confluent CLI provides an option to check for a newer version of Confluent CLI.

The check is controlled by the disable_update_check setting in the ~/.confluent/config.json file. The Confluent CLI checks for updates once a day when it is set to "disable_update_check": false.

The default setting is:

  • The independently downloaded Confluent CLI has update checks enabled ("disable_update_check": false).

  • The Confluent CLI packaged with Confluent Platform has update checks disabled ("disable_update_check": true).

When the update check feature is enabled, your Confluent CLI needs access to s3-us-west-2.amazonaws.com/confluent.cloud. For more information, see Network access.

When a check returns with a message that a newer version of Confluent CLI is available, you can update the Confluent CLI to the new version using the confluent update command.