Lesson 5 of 5 Schema Evolution and Data Lineage

Enforcing Streaming Compatibility with a Schema Registry

This lesson explains how schema registries make the contract between independently deployed producers and consumers explicit, rejecting incompatible changes before they reach the stream.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe how the AWS Glue Schema Registry validates records.
  • Distinguish BACKWARD, FORWARD, FULL and NONE compatibility.
  • Apply the same discipline to tables in the lake.

AWS Glue Schema Registry

In streaming systems, producers and consumers are separate applications, often owned by different teams, and a producer that changes its record structure can break every consumer. The AWS Glue Schema Registry manages schemas for streaming data to prevent this. It stores versioned schemas in Avro, JSON Schema or Protobuf format, grouped into registries.

Producers serialise records with Schema Registry SerDe (serializer/deserializer) libraries, which embed a schema version ID in each record; consumers use the ID to fetch the exact schema, so records stay compact and self-describing. Each schema has a compatibility mode, such as backward compatibility, and a new version that breaks it is rejected. Producers can register new versions automatically, still subject to that check.

The registry works with Kinesis Data Streams through the Kinesis Producer and Client Libraries, with Amazon MSK and Apache Kafka, with Amazon Managed Service for Apache Flink, and with Lambda and Glue streaming jobs. Teams that already use Confluent Schema Registry with Kafka can keep running it alongside Amazon MSK.

True or false

The Glue Schema Registry

Exam skills 2.4.2 · 1.1.1

Decide whether each statement about the Glue Schema Registry is true.

Log in to try this activity Interactive activities are free with an account.

Compatibility modes

A schema registry checks each new schema version against earlier ones, and the compatibility mode sets the rules. BACKWARD, the default, means consumers using the new schema can read data written with the previous one, so consumers upgrade first. Deleting fields and adding fields with default values are safe, because the default fills the new field in old records. FORWARD means consumers using the previous schema can read data written with the new one, so producers upgrade first. Adding fields, and deleting fields that have defaults, are safe.

FULL requires both, so either side can upgrade first, and only fields with defaults may be added or deleted. The _ALL variants check the new schema against every previous version, not just the latest. NONE performs no checks and DISABLED stops new versions being registered, so neither protects consumers. The following table summarises the modes.

ModeWho upgrades firstSafe changes
BACKWARD (default)ConsumersDelete fields; add fields with defaults
FORWARDProducersAdd fields; delete fields that have defaults
FULLEitherAdd or delete fields with defaults
BACKWARD_ALL, FORWARD_ALL, FULL_ALLAs aboveChecked against every previous version
NONE / DISABLEDAnyoneNo protection

The following diagram shows the Glue Schema Registry checking two new schema versions for an order events topic.

The Glue Schema Registry guarding the order events topic. Producers serialise with the registry's serializer, and each new schema version is checked against BACKWARD compatibility. Renaming a field, equivalent to deleting it and adding a required one, is rejected before deployment; adding an optional field with a default passes.
The field names are illustrative.
Match the pairs

Compatibility modes

Exam skills 2.4.2

Match each compatibility mode with its rule.

Log in to try this activity Interactive activities are free with an account.

Schema changes in the lake

Tables in the lake need the same discipline. Glue crawlers' schema change policy can update the table, add new columns only, or just log changes; partitions can inherit the table schema to avoid mismatches. Apache Iceberg tracks columns by ID, so columns can be added, renamed, dropped or widened without rewriting data or breaking old snapshots. With plain Parquet or CSV, renaming or reordering columns can silently shift data, which is why many teams move evolving tables to Iceberg.

Worked example

Several teams consume an MSK topic of order events. Last month a producer renamed a field and three consumers failed in production. The company wants such changes to be rejected before deployment, while still allowing new optional fields.

Register the order schema in the Glue Schema Registry with BACKWARD (or FULL) compatibility, and have producers use the registry's serializer. A rename (equivalent to deleting a field and adding a required one) fails the compatibility check, while adding an optional field with a default passes.

Check yourself

With BACKWARD compatibility, who upgrades first, producers or consumers?

Show answer

Consumers, because they can read data written with the previous schema. With FORWARD compatibility, producers upgrade first.

Exam Tips

Remember for the exam

  • Glue Schema Registry supports Avro, JSON Schema and Protobuf with Kinesis, MSK, Flink and Lambda.
  • Records carry a schema version ID; consumers fetch the schema from the registry.
  • BACKWARD: upgrade consumers first; FORWARD: upgrade producers first; FULL: both directions.
  • Adding a field with a default is backward compatible; adding a required field is not.
  • Iceberg tracks columns by ID for safe schema evolution in the lake; crawlers have schema change policies.