Get Started with Confluent CLI

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.

Prerequisites

Before you proceed with the Confluent CLI Quick Start, ensure you 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.

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 admin 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

To get started, install the latest version of the Confluent CLI by completing the following steps. For more installation options, see the Install Confluent CLI page.

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

    curl -sL --http1.1 https://cnfl.io/cli | 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:

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

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

    confluent login
    

    Tip

    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-beginning
    

    For example:

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

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 confluent update 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 confluent update 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.