Quick Start for Schema Management on Confluent Cloud¶
You can use Confluent Cloud Schema Registry to manage schemas in Confluent Cloud. You enable a single Schema Registry per Confluent Cloud environment. Schema Registry is accessed over port 443.
You can create and edit schemas in a schema editor and associate them with Kafka topics.
This quick start does not cover all the capabilities of Schema Registry, but rather is an introduction. For a complete guide, see Manage Schemas in Confluent Cloud.
Important
- Your VPC must be able to communicate with the Confluent Cloud Schema Registry public internet endpoint. For more information, see Confluent Cloud Schema Registry in Private Networking Environment.
- This quick start assumes that you have completed Quick Start for Confluent Cloud, including installing and using the Confluent Cloud CLI.
- This quick start requires that you use both the Confluent Cloud Console and the Confluent Cloud CLI. (A handy list of CLI commands is here.)
Log in to the Cloud Console¶
- Log in to Confluent Cloud at https://confluent.cloud.
- Select an environment or create a new one.
Choose a Stream Governance package and enable Schema Registry for Confluent Cloud¶
Choose a Stream Governance package to enable Schema Registry, Stream Catalog, and Stream Lineage.
When you add a new environment, Confluent Cloud provides you with Stream Governance package options. You have similar options to upgrade your existing environments that were set up without Stream Governance; the only exception being that you cannot change regions in environments that were set up without Stream Governance.
- Essentials: Includes Schema Registry with 1,000 included schemas and 9 cloud regions, stream catalog with auto-technical metadata ingestion, tags metadata, UI, REST API, and most features in stream lineage
- Advanced: Includes Schema Registry with 20,000 included schemas and 31 cloud regions, stream catalog with everything in Essentials plus business metadata
and GraphQL API, and stream lineage
with everything in Essentials plus point in time lineage, searchable lineage graph,
and Data Contracts on Confluent Cloud. Starting in Q3 2023,
TRANSFORM
rules for Data Contracts will be an add-on charge, priced at $0.1/hr/rule (10 cents per rule). Until then, these are included with no additional charge. - No Stream Governance (“Not now, I’ll enable later”): No access to Schema Registry or Stream Governance features
Choose a cloud provider and region.
- Select Amazon Web Services (AWS), Google Cloud Platform (GCP), or Microsoft Azure (Azure).
- Choose a Region in your area such as, in Europe,
eu-central-1 (Frankfurt)
on AWS,westeurope (Netherlands)
on Azure, oreurope-west3 (Frankfurt)
on GCP. These options vary depending on the selected package and cloud provider. For a full list of regions available for the Essentials and Advanced packages, see Cloud Providers and Region Support. - Click Enable Schema Registry.
The Advanced package lets you select any of the available regions from any of the providers. A subset of regions is available for the Essentials package. If you choose a region not available on your selected package, you will be asked to either upgrade or make a different selection.
Important
Cloud provider and region settings cannot be changed once you set up your environment. If you upgrade to the Advanced package later, you will not have the option of selecting regions for this environment as you would if you had enabled the Advanced package for this environment to begin with.
Review your settings, and click Enable to create the Schema Registry with these cloud provider and region settings.
This creates a Schema Registry to serve all clusters in the current environment. The environment level Schema Registry settings are shown on the right-side panel.
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 Quick Start for Confluent Cloud.
- 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.
In the environment for which you want to set up Schema Registry, find Credentials on the right side panel and click <someNumber> keys to bring up the API credentials dialog. (If you are just getting started, click 0 keys.)
Click Add key to create a new Schema Registry API key.
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.
Your new Schema Registry key is shown on the Schema Registry API access key list.
Schema Registry API Keys for Multi-Tenant Clusters¶
Confluent Cloud supports one Schema Registry per environment. In multi-tenant deployments, one physical Schema Registry per cloud and geographic region hosts many logical schema registries. In these cases, the registries for different Kafka clusters in different environments will have the same URL as the Confluent Cloud Schema Registry. Confluent Cloud uses the Schema Registry API keys to store schemas and route requests to the appropriate logical clusters.
Tip
To learn more about other environment level schema management options available on the Environment settings page, see Configure and Manage Schemas for an Environment.
Create a Topic in Confluent Cloud¶
You may already have topics available on this cluster, having worked through the prerequisite Quick Start for Confluent Cloud, 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.
Click Topics on the left menu, then click Add topic.
Name the new topic
employees
, and click Create with defaults to add it.
Create a Schema¶
You can create schemas for topics from the Cloud Console, from the unified Confluent CLI, the Schema Registry API (see POST /subjects/(string: subject)/versions), or through the Schema Registry Maven Plugin (see schema-registry:register).
This section shows you how to create a schema from the Confluent CLI CLI, just to provide a 360 view of cloud tools and demonstrate how you can use the web UI and the CLI to interact with the same entities, such as environments, clusters, topics, and schemas.
If you need more help with the basic CLI commands, type confluent --help
, confluent schema-registry --help
to drill down, or see Quick Start for Confluent Cloud and the Confluent CLI command reference.
Log in to the Confluent Cloud CLI.
confluent login
Follow the prompts to enter your credentials (email and password).
Upon login, Confluent Cloud indicates your current environment.
Enter your Confluent credentials: Email: Password: Using environment t2814 ("my-cloud-demos")
Select the environment where you created the
employees
topic. (It may already be selected upon login.)In order to verify this, use
confluent environment list
to get the environment IDs, followed byconfluent environment use <ID>
to select the environment you want (if it is not already the current environment).For example:
confluent environment list
Your output should resemble:
Id | Name +-------------+--------------------+ * t2703 | default env-vnywz | ccloud-demo env-qzrg2 | data-lineage-demo env-250o2 | my-new-environment
To use “ccloud-demo”:
confluent environment use env-vnywz
Tip
- To list environments:
confluent environment list
- To select an environment:
confluent environment use <environment ID>
- To list clusters:
confluent kafka cluster list
- To select a cluster:
confluent kafka cluster use <cluster ID>
- For the full list of
confluent
commands see Confluent 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
.confluent schema-registry schema create --subject employees-value --schema employees.json --type AVRO
For example:
confluent schema-registry schema create --subject employees-value --schema employees.json --type AVRO Enter your Schema Registry API Key: xxxx Enter your Schema Registry API Secret: xxxxyyyyzzzz Successfully registered schema with ID: 100001
Tip
You have the option to create schemas that reference other schemas by using the
--refs <ref-file>
flag withconfluent schema-registry schema create
. To learn more about schema references, see Schema References in the Confluent Platform documentation. You can also create schema references from the web UI.You must specify a schema format type as one of
AVRO
,JSON
, orPROTOBUF
, and then supply a schema that conforms to the syntax for that type. To learn more about development using these schema formats, see Schema Formats, Serializers, and Deserializers in the Confluent Platform documentation, the JSON Schema project documentation, the Apache Avro® specification, and the Google Developer documentation on Protocol Buffers.You can also create a schema from the web UI. To do so, select an environment and cluster, select a topic, then click the Schema tab for that topic. Select a schema format type (for this example, Avro), paste the schema (such as the
employees.json
content), and click Save.
View the Topic and Associated Schema¶
Return to the Cloud Console 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 Schema.
- Click the arrows next to fields to expand the elements in the tree view:
- Click the button in the upper left to toggle to the code view:
And there you have it! You have a new schema (
employees-value
) for theemployees
topic in Confluent Cloud Schema Registry.
Configure and Manage Schemas for an Environment¶
Several tasks related to schemas on Confluent Cloud are managed at the environment level. This includes creating and managing Schema Registry API keys along with options, as described below, to view and search schemas, monitor usage, and set a compatibility mode for schemas.
View and Search All Schemas in an Environment¶
To view a searchable list of all schemas available in a Confluent Cloud environment:
Select an environment.
Click the Schemas in the right-side panel.
The schemas list is shown.
- You can use Search to find schemas in longer lists
- Click a schema to drill down for more options, including view, download, duplicate, or delete a schema; navigate to compatibility settings; traverse the schema version history, view each version, and compare versions.
View and Edit Global Compatibility Settings on Schemas¶
The default compatibility mode is Backward. From the environment level Schema Registry settings, you can change the mode, which will apply globally to all schemas in an environment. You can also change compatibility settings for a schema on a specific topic (at the subject level). Subject-level compatibility settings override the global settings.
Caution
If you change the compatibility mode of existing schemas already in production use, be aware of any possible breaking changes to your applications.
Select an environment.
Click the Schemas in the right-side panel.
Click Edit on the Compatibility setting card.
The Compatibility settings are shown.
Select a mode option:
- Backward (Confluent Schema Registry default)
- Transitive backward
- Forward and Transitive forward
- Full and Transitive full
- None (not recommended)
Descriptions indicate the compatibility behavior for each option. For more information, including the changes allowed for each option, see Schema Evolution and Compatibility.
Click Save.
Use curl to View and Manage Schemas¶
You can also use curl commands to view and manage schemas on Confluent Cloud.
Schema Registry on Confluent Cloud requires that you pass the API Key and Secret with the --user
(or -u
) flag.
For example, to view all subjects in the registry:
curl --user <schema-registry-api-key>:<schema-registry-api-secret> \
<schema-registry-url>/subjects
For more information about using curl commands with Schema Registry, see Schema Registry API Usage Examples. With the exception of this one same example, the examples are for on-premises Schema Registry but many of the commands are relevant to Confluent Cloud, once you know how to pass your API Key and Secret as shown here.
Suggested Reading¶
Schemas Product Documentation¶
- Working with schemas
- Stream Governance on Confluent Cloud
- Confluent Cloud Schema Registry Tutorial
- Quick Start for Confluent Cloud
- Schema Registry Clusters API Quick Start for Confluent Cloud shows how to work with Stream Governance packages, regions, and Schema Registry clusters through the API.
- Confluent Cloud Console
- Confluent Cloud CLI Schema Registry commands
- Schema Management
- Migrate Schemas
- Confluent Cloud schemas limits and how to free up space
- Schema Formats, Serializers, and Deserializers (Confluent Platform tools that support application development for Confluent Cloud and self-managed systems)
- Run an automated Confluent Cloud quickstart with Avro, Protobuf, and JSON formats