Configure the Confluent Cloud CLI for Multiple Environments

You can provide restricted access to Confluent Cloud clusters by using the ccloud init command. This command allows you to authenticate with Confluent Cloud using as a Apache Kafka® API key and secret pair.

Each authentication instance that you create is saved.

Important

When you connect to a cluster using ccloud init with the --kafka-auth option, you are limited to produce and consume. Topic management is currently not supported.

Prerequisites:
  1. Create and log in to your environment by using the ccloud init command, where <context-name> is your environment name. This requires an Kafka API key and the bootstrap server URL of the Confluent Cloud environment.

    ccloud init <context-name> --kafka-auth
    

    You should be prompted to enter the login information:

    Bootstrap: xxx
    API Key: xxx
    API Secret: xxx
    
  2. You can now produce or consume to your Confluent Cloud environment. For more information, see ccloud kafka topic produce and ccloud kafka topic consume.