You are viewing documentation for an older version of Confluent Platform. For the latest, click here.

Connect Confluent Cloud CLI to a Cluster

You can connect your Confluent Cloud CLI instance to a Confluent Cloud cluster by specifying a configuration file on startup.

The Confluent Cloud CLI configuration files are stored in <home-dir>/.ccloud/. By default, if you run ccloud init without any arguments, a configuration file is created and stored at <home-dir>/.ccloud/config.

Follow these steps to create configuration files and connect to a Confluent Cloud instance,

  1. Run the ccloud init command with a unique configuration directory specified. This directory is where your configuration file will be stored.

    ccloud --config-dir ~/.ccloud/<myclustername>/ init


    You can specify the directory name, but all configuration files are named config. For example, if you run ccloud --config-dir ~/.ccloud/prod-cluster/ init, the resulting config file and directory is /.ccloud/prod-config/config.

  2. Enter your bootstrap broker list, API key, and API secret. You should be automatically prompted to enter this information after the previous step.

    To find the cluster configuration information, navigate to the Management -> Clusters page, click the ellipses (...) next to your cluster name, and click Client config.

    Bootstrap broker list: <path-to-ccloud>
    API Key: <api-key>
    API Secret: <api-secret>
    Initialized. Saved config to /Users/<username>/.ccloud/<myclustername>/config


    You must specify --config-dir argument for all subsequent Confluent Cloud commands targeted at this cluster. For example:

    ccloud --config-dir ~/.ccloud/prod-cluster topic list example_topic_1