To create a schema registry, call the Event Gateway API’s /schema-registries endpoint.
curl -X POST https://{region}.api.konghq.com/v1/event-gateways/{eventGatewayId}/schema-registries \
--header "accept: application/json" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $KONNECT_TOKEN" \
--data '
{
"name": "my-schema-registry",
"type": "confluent",
"config": {
"schema_type": "avro",
"endpoint": "endpoint",
"timeout_seconds": 10,
"authentication": {
"type": "basic",
"username": "username",
"password": "'$MY_PASSWORD'"
}
}
}
'
Make sure to replace the following placeholders with your own values:
-
region: Geographic region where your Kong Konnect is hosted and operates.
-
KONNECT_TOKEN: Your Personal Access Token (PAT) associated with your Konnect account.
-
virtualClusterId: The id of the Virtual Cluster.
-
eventGatewayId: The id of the Event Gateway.
-
eventGatewayListenerId: The id of the Event Gateway Listener.
See the Konnect Event Gateway API reference to learn about region-specific URLs and personal access tokens.
Prerequisite: Configure your Personal Access Token
terraform {
required_providers {
konnect-beta = {
source = "kong/konnect-beta"
}
}
}
provider "konnect-beta" {
personal_access_token = "$KONNECT_TOKEN"
server_url = "https://us.api.konghq.com/"
}
Add the following to your Terraform configuration:
resource "konnect_event_gateway_schema_registry" "my_schema_registry" {
provider = konnect-beta
type = "confluent"
config = {
schema_type = "avro"
endpoint = "endpoint"
timeout_seconds = 10
authentication = {
type = "basic"
username = "username"
password = "$MY_PASSWORD"
}
}
gateway_id = konnect_event_gateway.my_event_gateway.id
}
The following creates a new schema registry called my-schema-registry.
Add this snippet to an event_gateways resource in your declarative configuration file, and then manage it with kongctl:
event_gateways:
- ref: eventGatewayName
name: eventGatewayName
schema_registries:
- ref: my-schema-registry
name: my-schema-registry
type: confluent
config:
schema_type: avro
endpoint: endpoint
timeout_seconds: 10
authentication:
type: basic
username: username
password: "$MY_PASSWORD"
Make sure to replace the following placeholders with your own values:
-
eventGatewayName: The name of your Event Gateway.
The following creates a new schema registry called my-schema-registry with basic configuration:
- In Konnect, navigate to Event Gateway in the sidebar.
- Click an Event Gateway.
- Click the Resources tab.
- Click New Schema Registry.
- In the Name field, enter
my-schema-registry.
- Configure your schema registry.
- Click Create.