Preventing Upstream Breakage with Data Contracts
This lesson explains how a data contract makes the expectations between a dataset's producer and its consumers explicit and enforceable, since many quality problems start when a producer changes a dataset without telling consumers.
Learning outcomes
After completing this lesson, you will be able to:
- Identify what a data contract contains.
- Enforce each part of a contract with AWS tools.
- Check contracts at the producer's boundary.
What a contract contains
A data contract is an agreement between the producer of a dataset and its consumers, written down so that both sides know what to expect. It defines the schema: the fields, their types and which are required. It defines the meaning of each field and the grain of the dataset, such as one row per order line, which prevents consumers from misinterpreting the data.
It also states quality rules and service levels, such as the rules every row must satisfy and that the data will be fresh by 06:00 each day, and it names the owner, the support contacts and the process for changing the contract, so that changes are negotiated rather than imposed.
Inside a data contract
Enforcing contracts
A data contract is an agreement between the producer and the consumers of a dataset. It covers the dataset's schema, quality, freshness and ownership, and each part needs its own enforcement. The schema of streaming data is enforced by the Glue Schema Registry, whose compatibility mode rejects breaking changes. The schema of lake tables is protected by managing Iceberg schema changes through review and by setting crawlers only to log schema changes, not apply them.
Quality rules run as Glue Data Quality rulesets in the producer's pipeline, so bad data is stopped at the source. Freshness is enforced with freshness rules and CloudWatch alarms. Ownership and terms are published with data products in SageMaker Catalog. The following table summarises the enforcement.
| Contract element | Enforcement |
|---|---|
| Schema of streaming data | Glue Schema Registry with a compatibility mode |
| Schema of lake tables | Iceberg schemas managed through reviewed changes; crawler change policies that only log |
| Quality rules | Glue Data Quality rulesets in the producer's pipeline |
| Freshness | Freshness rules and CloudWatch alarms |
| Ownership and terms | Published data products in SageMaker Catalog |
The following diagram matches each contract element to its enforcement.

Enforcing a contract
Enforcing at the producer
A contract is most effective when it is checked at the producer's boundary, before data is published. A breaking change then fails in the producer's own pipeline, where the producing team can fix it, instead of breaking every downstream team at once. This also supports data mesh designs, in which domains publish data products to agreed standards.
A product team changed a customer field from a number to text, and three downstream pipelines failed overnight. The data platform team wants such changes caught before they are published.
Agree a data contract for the customer dataset, register its schema in the Glue Schema Registry with BACKWARD compatibility (or validate the table schema in the producer's CI pipeline), and run the contract's quality rules before publishing. The type change then fails in the product team's pipeline, and consumers are unaffected.
Where should a data contract be enforced?
Show answer
At the producer's boundary, before data is published.
Exam Tips
Remember for the exam
- Data contracts define schema, semantics, quality and ownership between producers and consumers.
- Enforce contracts at the producer's boundary, before data is published.
- Schema registries enforce schema compatibility for streams.
- SageMaker Catalog records ownership and publishes data products.
- Contracts support data mesh designs.