<a id="confluent-cli-overview"></a>

# 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.

The CLI source code is available in the [confluentinc/cli repository on
GitHub](https://github.com/confluentinc/cli) under the Confluent
Community License. For more information, see the
[Announcing the Source Available Confluent CLI](https://www.confluent.io/blog/announcing-the-source-available-confluent-cli/) blog post.

<a id="cli-requirements"></a>

## 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](#cli-quick-start), 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](https://docs.confluent.io/platform/current/installation/versions-interoperability.html#confluent-cli).
- The Confluent CLI for Confluent Platform requires that you have the [Confluent REST Proxy server for Apache Kafka](/platform/current/kafka-rest/index.html) running. The Confluent REST Proxy server mediates
  uses the [APIs](/platform/current/kafka-rest/api.html) 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](/platform/current/multi-dc-deployments/cluster-linking/topic-data-sharing.html)
  uses the Kafka scripts throughout (such as `kafka-cluster-links --list` to [list mirror topics](/platform/current/multi-dc-deployments/cluster-linking/topic-data-sharing.html#list-mirror-topics)
  rather than [confluent kafka topic list](/platform/current/command-reference/kafka/topic/confluent_kafka_topic_list.html) or [confluent kafka link list](/platform/current/command-reference/kafka/link/confluent_kafka_link_list.html)).
  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](https://docs.confluent.io/cloud/current/api.html) under the hood.)

<a id="cli-glibc-requirements"></a>

### 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.

<a id="cli-network-connections"></a>

### 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](command-reference/billing/payment/index.md#confluent-billing-payment) commands.
- `s3-us-west-2.amazonaws.com/confluent.cloud` when the [update check](#cli-update-check) is enabled.

To minimize access to these domains, you can:

- Disable [update checks](#cli-update-check).
- Do not use the [confluent billing payment](command-reference/billing/payment/index.md#confluent-billing-payment) commands.

<a id="cli-quick-start"></a>

## 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](install.md#cli-install)
   following the instructions for your operating system.
2. Sign up for a free Confluent Cloud account by entering the following command in your
   terminal:
   ```text
   confluent cloud-signup
   ```

   The browser redirects to the [free Confluent Cloud account](https://www.confluent.io/get-started/) sign-up page.
3. After signing up for a free account, start autocomplete by entering
   the following command:
   ```text
   confluent shell
   ```
4. Using the `confluent` interactive shell, enter the following command to log
   in to Confluent Cloud:
   ```text
   login
   ```

   If you have not saved your credentials locally, enter them at the
   following prompts:
   ```text
   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:
   ```text
   kafka cluster create <name> --cloud <cloud_provider> --region <cloud_region>
   ```

   For example:
   ```text
   kafka cluster create dev0 --cloud aws --region us-east-1
   ```

   The output should resemble the following:
   ```text
   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:
   ```text
   kafka topic create <name> --cluster <cluster_id>
   ```

   For example:
   ```text
   kafka topic create test_topic --cluster lkc-dfgrt7
   ```

   The output confirms that the topic was created:
   ```text
   Created topic "test_topic".
   ```
7. Create an API key for the cluster:
   ```text
   api-key create --resource lkc-dfgrt7
   ```

   The output should resemble the following:
   ```text
   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:
   ```text
   kafka topic produce <topic_name> --api-key <your_api_key> --api-secret <your_api_secret>
   ```

   For example:
   ```text
   kafka topic produce test_topic --api-key <your_api_key> --api-secret <your_api_secret>
   ```

   The output should resemble the following:
   ```text
   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:
   ```text
   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:
    ```text
    kafka topic consume <topic_name> --api-key <your_api_key> --api-secret <your_api_secret> --from-beginning
    ```

    For example:
    ```text
    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:
    ```text
    Starting Kafka Consumer. Use Ctrl-C to exit.
    forever
    now
    today
    then
    ```

<a id="cli-update-check"></a>

## 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](#cli-network-connections).

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-reference/confluent_update.md#confluent-update) command.

## Related content

- GitHub: To contribute to the Confluent CLI project, review the [CLI contribution guide](https://github.com/confluentinc/cli/blob/main/CONTRIBUTING.md).
