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
- Your VPC must be able to communicate with the Confluent Cloud Schema Registry public internet endpoint. For more information, see Using Confluent Cloud Schema Registry in a VPC Peered Environment.
- This quick start assumes that you have completed Confluent Cloud Quick Start, including installing and using the Confluent Cloud CLI.
- This quick start requires that you use both the Confluent Cloud UI and the Confluent Cloud CLI. (A handy list of CLI commands is here.)
Log in to the Confluent Cloud UI¶
- Log in to Confluent Cloud at https://confluent.cloud.
- Select the same environment (default) and cluster (e.g., My First Cluster) as for the Confluent Cloud Quick Start.
Enable Schema Registry for Confluent Cloud¶
- To verify this, use the Confluent Cloud CLI
- to run
ccloud environment list
andccloud kafka cluster list
. If you need more help on setting the active environment or cluster, see Confluent Cloud Quick Start and the Confluent Cloud CLI Command Reference.
Log in to the Confluent Cloud UI at https://confluent.cloud.
Click Schemas on the navigation bar.
Choose a cloud provider and region.
- Select Amazon Web Services (AWS), Google Cloud Platform (GCP), or Azure
- Choose a Region. US, Europe, and APAC are the available choices.
- Click Enable Schema Registry.
Click Confirm to create the Schema Registry with these cloud provider and region settings, or click Cancel to go back and re-set.
Under Make requests to this Schema Registry endpoint, copy the Schema Registry endpoint to a safe location.
Create an API Key for Confluent Cloud Schema Registry¶
To use Confluent Cloud Schema Registry for managing Kafka clusters, you need an API key specific to Schema Registry.
Note
- The API key for Confluent Cloud Schema Registry is distinct from the API key you created for Kafka clusters in the same environment, per the Confluent Cloud Quick Start.
- Confluent Cloud provides one Schema Registry per environment, and each environment can contain multiple Kafka clusters. You need an API key/secret pair for each Kafka cluster and another for the Schema Registry cluster.
Click the Manage Keys button under step 1 to open the API access list of Schema Registry API keys.
Click Create key to create a new Schema Registry API key.
On the Create a new Schema Registry API key dialog, copy the API Key and the API Secret to a safe location.
When the API Key and API Secret are saved, click the checkbox next to I have saved my API key and secret and am ready to continue., and click Continue.
Create a Topic in Confluent Cloud¶
You will already have topics available, having worked through the prerequisite Confluent Cloud Quick Start, but create a new topic designed to test out Schema Registry.
Select the environment.
Tip
If you have only one environment, default, it will be selected already.
Select the cluster.
Use the same cluster as for the Confluent Cloud Quick Start (e.g, My First Cluster).
Click Topics on the left menu, then click + Add a topic.
Name the new topic
employees
, and click Create with defaults to add it.
Create a Schema¶
Use the Confluent Cloud CLI to create the schema. If you need more help with the basic CLI commands, see Confluent Cloud Quick Start and the Confluent Cloud CLI Command Reference.
Log in to the Confluent Cloud CLI.
ccloud login
Follow the prompts to enter your credentials (email and password).
Upon login, Confluent Cloud indicates your current environment (e.g., the default t182).
Enter your Confluent credentials: Email: Password: Using environment t2814 ("my-cloud-demos")
Select the same environment (for this example,
default
) where you created theemployees
topic. (It may already be selected upon login.)In order to verify this, use
ccloud environment list
to get the environment IDs, followed byccloud environment use <ID>
to select the environment you want (if it is not already the current environment).ccloud environment list
For example:
$ ccloud environment list Id | Name +----------+----------------+ * t1898 | default t2814 | my-cloud-demos t25500 | Test
ccloud environment use t1898
Tip
- To list environments:
ccloud environment list
- To select an environment:
ccloud environment use <environment ID>
- To list clusters:
ccloud kafka cluster list
- To select a cluster:
ccloud kafka cluster use <cluster ID>
- For the full list of
ccloud
commands see Confluent Cloud CLI Command Reference.
- To list environments:
Create a file containing the following JSON and name it
employees.json
.{ "type" : "record", "namespace" : "Example", "name" : "Employee", "fields" : [ { "name" : "Name" , "type" : "string" }, { "name" : "Age" , "type" : "int" } ] }
Create a schema that uses
employees.json
.ccloud schema-registry schema create --subject employees-value --schema employee.json
For example:
$ ccloud schema-registry schema create --subject employees-value --schema employee.json Enter your Schema Registry API Key: xxxx Enter your Schema Registry API Secret: xxxxyyyyzzzz Successfully registered schema with ID: 100001
Tip
To quickly see more
ccloud schema-registry
command options:ccloud schema-registry --help
View the Topic and Associated Schema¶
Return to the Confluent Cloud UI to view the new schema for the employees
topic.
Navigate to the topics list for your cluster.
Click the employees topic you created in a previous step.
Click Schemas.
And there you have it! You have a new schema (
employees-value
) for theemployees
topic in Confluent Cloud Schema Registry.
Suggested Reading¶
- Confluent Cloud Quick Start
- Confluent Cloud UI
- Confluent Cloud CLI Command Reference, especially the
ccloud schema-registry ..
commands in that list - Managing Schemas for Topics in Confluent Cloud
- Schema Management
- Migrate Schemas
- Confluent Cloud schemas limits and how to free up space
- Blog post: Confluent Cloud Schema Registry is Now Generally Available