Configure Confluent Cloud Schema Registry

You can use Confluent Cloud Schema Registry to manage schemas in Confluent Cloud. You enable a single Schema Registry per cluster.

You can create and edit schemas in a schema editor and associate them with Kafka topics.

Important

Enable Schema Registry for Confluent Cloud

  1. Click Schemas on the left-side panel.

  2. Choose a cloud provider and region.

    • Select Amazon Web Services (AWS) or Google Cloud Platform (GCP)
    • Choose a Region. US, Europe, and APAC are the available choices.
    • Click Enable Schema Registry.
    ../../_images/cloud-sr-enable.png
  3. Click Confirm to create the Schema Registry with these cloud provider and region settings, or click Cancel to go back and re-set.

    ../../_images/cloud-sr-provider-region.png
  4. Under Make requests to this Schema Registry endpoint, copy the Schema Registry endpoint to a safe location.

    ../../_images/cloud-sr-view1.png

For more information, see Managing Schemas for Topics in Confluent Cloud.

Configure the Confluent Cloud CLI for Schema Registry

To access Confluent Cloud Schema Registry with the Confluent Cloud CLI, generate an API access key and assign the key in the Confluent Cloud CLI configuration file.

Note

The API key for Confluent Cloud Schema Registry is distinct from the API key that you created in a previous step for accessing Confluent Cloud.

  1. Click the Manage Keys button under step 1 to open the API access list of Schema Registry API keys.

    Screenshot of the Schema Registry page in Confluent Cloud
  2. Click Create key to create a new Schema Registry API key.

    Screenshot of the Create Schema Registry API Key page in Confluent Cloud
  3. In the Create a new Schema Registry API key dialog, copy the API Key and the API Secret to a safe location.

    Screenshot of the Copy Schema Registry API Key dialog in Confluent Cloud
  4. When the API Key and API Secret are saved, check I have saved my API key and secret and am ready to continue. and click Continue.

    Screenshot of the Registry API Key page in Confluent Cloud
  5. In the Confluent Cloud configuration file, add the Schema Registry authorization settings that you saved in a previous step. The default location for the file is ~/.ccloud/config.json.

    basic.auth.credentials.source=USER_INFO
    schema.registry.basic.auth.user.info=<schema-registry-api-key>:<schema-registry-api-secret>
    schema.registry.url=https://<schema-registry-url>
    
  6. In the Confluent Cloud configuration file, add the Avro serializer.

    // Enable Avro serializer with Schema Registry (optional but recommended)
    key.serializer=io.confluent.kafka.serializers.KafkaAvroSerializer
    value.serializer=io.confluent.kafka.serializers.KafkaAvroSerializer
    

    Your configuration file should resemble this.

    cat ~/.ccloud/config.json
    ssl.endpoint.identification.algorithm=https
    sasl.mechanism=PLAIN
    request.timeout.ms=20000
    bootstrap.servers=<bootstrap-server-url>
    retry.backoff.ms=500
    sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="<kafka-api-key>" password="<kafka-api-secret>";
    security.protocol=SASL_SSL
    
    // Schema Registry specific settings
    basic.auth.credentials.source=USER_INFO
    schema.registry.basic.auth.user.info=<schema-registry-api-key>:<schema-registry-api-secret>
    schema.registry.url=<schema-registry-url>
    
    // Enable Avro serializer with Schema Registry (optional but recommended)
    key.serializer=io.confluent.kafka.serializers.KafkaAvroSerializer
    value.serializer=io.confluent.kafka.serializers.KafkaAvroSerializer
    
  7. Save your changes to the Confluent Cloud configuration file.

  8. Optional: Verify that your Schema Registry credentials are properly configured, where Schema Registry API key (<schema-registry-api-key>), API secret (<schema-registry-api-secret>), and endpoint (<schema-registry-url>) are specified.

    Run this command to authenticate with the cluster and list the topics registered in your schema.

    curl -u <schema-registry-api-key>:<schema-registry-api-secret> \
    <schema-registry-url>/subjects
    

    If no subjects are created, your output will be empty ([]). If you have subjects, your output should resemble:

    ["test2-value"]
    

    Here is an example command:

    curl -u GFS3CFEX5ELQTB6O:2Nc69uGg+oKOdajqGXfZzuUoN1mBZarD0ZLiE5I9sVIQQhuNti1NSBnzslpgNG5J \
    https://psrc-lq2dm.us-east-2.aws.confluent.cloud/subjects