Confluent CLI Overview¶
The Confluent command line interface (CLI), confluent
, enables developers to
manage both Confluent Cloud and Confluent Platform.
It’s feature-packed to help users go from learning Confluent to building automated workflows.
Getting started¶
To install the latest version of the Confluent CLI, complete the following steps:
Download and install the latest version in the default directory,
./bin
:curl -sL --http1.1 https://cnfl.io/cli | sh -s -- latest
Add the
./bin
directory to your$PATH
:export PATH=$(pwd)/bin:$PATH
For additional installation options, see the Install Confluent CLI page.
Sign up for a free Confluent Cloud account by entering the following command and following the prompts:
confluent cloud-signup
Start auto complete using the following command:
confluent shell
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.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
Create a topic in the cluster:
confluent kafka topic create <name> --cluster <cluster ID>
For example:
confluent kafka topic create test_topic --cluster <ID of the dev0 cluster>
Create an API key for the cluster:
confluent api-key create --resource <cluster ID>
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 step 7> --api-secret <API secret created in step 7>
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.
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 in step 7> --api-secret <API secret created in step 7> --from-begining