AWS Data Engineering
Building a Medallion Architecture on AWS
DataForge AWS Data Engineering Series - Blog 13 of 20
The architecture diagram looked complete: S3 for storage, Glue for transformation, Athena for serving. Three layers, clean arrows, presented and approved. Six months into building it, the team discovered they’d built three buckets with folders named “bronze,” “silver,” and “gold” — and nothing else. No schema enforcement at any boundary. No quality gates. No lineage. A Glue job read from one folder and wrote to another, and that was the entire “architecture.”
When a Gold table started showing duplicate revenue, nobody could trace it back cleanly. The Bronze folder had the same file landed twice from a retried ingestion job. Nothing had caught it, because nothing was checking. The folder structure implied a Medallion architecture. The absence of any enforcement at the boundaries meant it was actually just three unstructured storage locations connected by a Glue job that assumed the data arriving was always correct.
This is the gap between naming your S3 prefixes “bronze/silver/gold” and actually building a Medallion architecture. The Databricks series covered this distinction in depth — Bronze prioritizes completeness, Silver prioritizes correctness, Gold serves specific consumers, and the architecture only works when each boundary enforces its contract. This article shows exactly how to build that enforcement using the AWS services covered in Blogs 1 through 12.
Let’s go deep.
TL;DR
A Medallion architecture on AWS uses S3 as the storage foundation for all three layers, with Glue or Athena CTAS handling the transformations between them, the Glue Data Catalog and Lake Formation providing the governance layer, and Step Functions orchestrating the pipeline end to end. The architecture’s value comes entirely from enforcing contracts at each layer boundary — append-only Bronze, validated Silver, consumer-optimized Gold — not from the S3 folder names themselves.
By the end of this article you’ll be able to:
- Implement Bronze, Silver, and Gold layer contracts using specific AWS service configurations, not just folder conventions
- Choose correctly between Glue jobs and Athena CTAS for each layer’s transformation, applying Blog 7’s framework concretely
- Configure Lake Formation as the AWS equivalent of Unity Catalog’s governance model
- Design the orchestration layer that enforces the pipeline runs in the correct order with proper error handling
Series context: This is the synthesis article for Phase 1 and Phase 2 — every service from Blogs 2 through 12 has a specific role in the architecture this article assembles.

The AWS Service Mapping to Medallion Layers
Before the implementation details, the layer-to-service mapping needs to be explicit, because “which service does what” is exactly the ambiguity that produced the opening scenario’s unenforced architecture.
Bronze Layer:
Storage: S3, raw format as received (Blog 2)
Ingestion: Kinesis/Firehose (Blog 8) for streaming,
Lambda (Blog 10) or Glue for batch
Catalog: Glue Data Catalog, schema evolution
permitted
Contract: Completeness - append-only, no filtering
Silver Layer:
Storage: S3, Parquet, partitioned (Blog 2)
Transformation: Glue jobs (Blog 5) for complex logic,
Athena CTAS (Blog 12) for SQL-expressible
cleaning
Catalog: Glue Data Catalog, schema enforced
Contract: Correctness - deduplicated, validated,
conformed schema
Gold Layer:
Storage: S3 (Athena-served) or Redshift
(high-concurrency, Blog 6)
Transformation: Athena CTAS/INSERT INTO, or Glue for
complex aggregation
Catalog: Glue Data Catalog + Lake Formation
governance (column masking, row filters)
Contract: Fitness for purpose - consumer-optimized,
separate objects per consumer pattern
The mapping principle that resolves most “which service” questions: apply Blog 7’s decision framework independently at each layer transition. Bronze-to-Silver often needs Glue’s DynamicFrame handling for schema inconsistency (Blog 5). Silver-to-Gold is frequently pure SQL aggregation, making Athena CTAS the cheaper and simpler choice (Blog 12). There’s no single “right” compute service for the whole pipeline — the right service is chosen per transformation, exactly as Blog 7 argued.
Bronze: Implementing Completeness as an Actual Enforced Contract
The Databricks series established that Bronze’s contract is completeness — land everything, filter nothing, never overwrite. On AWS, this contract needs to be implemented through specific configuration choices, not assumed from folder naming.
S3 bucket policy enforcing append-only behavior:
- Object versioning ENABLED on the Bronze bucket
(protects against accidental overwrites - even if
a process overwrites a key, the previous version
is recoverable)
- MFA Delete or a Lake Formation permission model
that doesn't grant s3:DeleteObject to any
automated pipeline role - deletion should require
a deliberate, audited action, never a routine
pipeline operation
- Lifecycle policy (Blog 2) transitioning to
Standard-IA/Glacier over time, WITHOUT ever
deleting - Bronze retention should map to
compliance/replay requirements, not storage
cost minimization alone# Bronze ingestion via Glue — append-only, schema-flexible
# Mirrors the Databricks series' Bronze pattern exactly,
# implemented with Glue DynamicFrames (Blog 5)
bronze_df = glueContext.create_dynamic_frame.from_options(
connection_type="s3",
connection_options={
"paths": ["s3://data-lake/raw-landing/events/"]
},
format="json",
transformation_ctx="bronze_read" # bookmark-tracked,
# Blog 5's discipline
)
# Add ingestion metadata — the same _ingested_at,
# _source_file pattern from the Databricks series
bronze_df = bronze_df.toDF() \
.withColumn("_ingested_at", current_timestamp()) \
.withColumn("_source_file", input_file_name())
# Write APPEND ONLY — never overwrite
bronze_df.write \
.format("parquet") \
.mode("append") \
.partitionBy("ingestion_date") \
.save("s3://data-lake/bronze/events/")The specific AWS-native enforcement mechanism that has no direct Databricks equivalent: Lake Formation’s tag-based access control can restrict which IAM roles have DELETE or OVERWRITE-equivalent permissions on Bronze table locations, separate from the S3 bucket policy itself — a second, catalog-layer enforcement point on top of the storage-layer one, covered in depth later in this article.
Silver: Validation as a Glue Job Step, Not an Afterthought
Silver’s correctness contract requires the same deduplication and validation discipline from the Databricks series, implemented here in PySpark within a Glue job.
from pyspark.sql.functions import (
col, row_number, desc, coalesce, lit, to_timestamp
)
from pyspark.sql.window import Window
# Read Bronze
bronze_df = glueContext.create_dynamic_frame.from_catalog(
database="raw_db", table_name="bronze_events",
transformation_ctx="silver_bronze_read"
).toDF()
# Type casting and standardization
silver_df = bronze_df \
.withColumn("event_ts", to_timestamp(col("event_ts_raw"))) \
.withColumn("region", coalesce(col("region"), lit("UNKNOWN")))
# Deduplication — the same window function pattern
# from the Databricks series, identical logic
window = Window.partitionBy("event_id").orderBy(desc("_ingested_at"))
silver_df = silver_df \
.withColumn("rn", row_number().over(window)) \
.filter(col("rn") == 1) \
.drop("rn")
# Validation — fail loudly if quality thresholds are breached
total_rows = silver_df.count()
null_event_ids = silver_df.filter(col("event_id").isNull()).count()
if null_event_ids > 0:
raise ValueError(f"Silver validation failed: "
f"{null_event_ids} null event_ids")
if total_rows < EXPECTED_MIN_ROWS:
raise ValueError(f"Silver validation failed: "
f"{total_rows} rows below expected minimum")
# Write Silver — Parquet, partitioned (Blog 2's principles)
silver_df.write \
.format("parquet") \
.mode("overwrite") \
.partitionBy("event_date") \
.save("s3://data-lake/silver/events/")Why this validation must run inside the Glue job, not as a separate downstream check: if validation runs after the Silver write completes, bad data has already landed and been cataloged — any consumer querying Silver in the window between the write and the validation catching the problem sees invalid data. Validating before the write (or writing to a staging location and promoting only after validation passes) is the correct pattern, mirroring the “fail loudly” quality enforcement from the Databricks series’ Medallion article.
Gold: Choosing Between Athena CTAS and Redshift Based on Consumer Pattern
This is where Blog 7’s decision framework and Blog 6’s Redshift depth converge directly. The Databricks series established that Gold objects should be separate per consumer pattern — the same principle applies on AWS, mapped to specific services.
-- Gold via Athena CTAS — for BI dashboards querying
-- aggregated data, cost-efficient at any scan volume
-- when Silver is well-partitioned Parquet (Blog 2, Blog 12)
CREATE TABLE gold.daily_revenue_by_region
WITH (
format = 'PARQUET',
external_location = 's3://data-lake/gold/daily_revenue/',
partitioned_by = ARRAY['event_date']
) AS
SELECT
event_date, region,
SUM(revenue) AS total_revenue,
COUNT(DISTINCT customer_id) AS unique_customers
FROM silver.events
WHERE event_type = 'purchase'
GROUP BY event_date, region;-- Gold via Redshift — for high-concurrency BI tool access
-- with complex joins (Blog 6's distribution/sort key
-- discipline applies in full)
CREATE TABLE gold.customer_360 (
customer_id VARCHAR(64) DISTKEY,
total_lifetime_value DECIMAL(18,2),
last_purchase_date DATE SORTKEY,
segment VARCHAR(32)
);
COPY gold.customer_360
FROM 's3://data-lake/gold/customer_360/'
IAM_ROLE 'arn:aws:iam::123456789:role/redshift-copy-role'
FORMAT AS PARQUET;The decision, applying Blog 7’s framework at this specific layer boundary: if Gold serves occasional or moderate-frequency BI dashboard queries on well-partitioned data, Athena CTAS is cheaper and requires no standing infrastructure. If Gold serves a high-concurrency BI tool with many simultaneous analysts running complex joins across multiple Gold tables, Redshift’s distribution-key-optimized joins (Blog 6) outperform repeated Athena scans, and the fixed cluster cost is justified by the query volume.
The Governance Layer: Glue Data Catalog + Lake Formation as Unity Catalog’s AWS Equivalent
The Databricks series established Unity Catalog’s four-layer security model — privilege hierarchy, column masking, row-level security, ABAC. AWS’s equivalent is the Glue Data Catalog (metadata) combined with Lake Formation (governance policies) — architecturally similar, mechanically different.
Unity Catalog concept AWS equivalent
─────────────────────────────────────────────────────
Three-level namespace Glue Catalog: database.table
(catalog.schema.table) (no separate "catalog" level
by default - achieved via
naming convention or
multiple Glue Catalogs
per account/region)
GRANT/REVOKE hierarchy Lake Formation permissions:
grant SELECT/DESCRIBE on
database, table, or column
Column masking Lake Formation column-level
permissions (restrict access
to specific columns per
principal) - less dynamic
than Unity Catalog's
function-based masking
Row-level security Lake Formation data filters
(row and cell-level security) -
conceptually equivalent,
different configuration model
ABAC (tag-based policies) Lake Formation LF-Tags -
directly equivalent concept,
tag resources and principals,
policies match on tags
Lake Formation permission grant, structurally parallel to Unity Catalog’s GRANT statements:
import boto3
lf_client = boto3.client('lakeformation')
lf_client.grant_permissions(
Principal={'DataLakePrincipalIdentifier': 'arn:aws:iam::123:role/analyst-role'},
Resource={
'Table': {
'DatabaseName': 'gold',
'Name': 'daily_revenue_by_region'
}
},
Permissions=['SELECT', 'DESCRIBE']
)LF-Tags implementing the ABAC pattern directly analogous to the Databricks series:
# Tag a column as sensitive
lf_client.add_lf_tags_to_resource(
Resource={
'TableWithColumns': {
'DatabaseName': 'gold',
'Name': 'customer_360',
'ColumnNames': ['ssn', 'date_of_birth']
}
},
LFTags=[{'TagKey': 'sensitivity', 'TagValues': ['high']}]
)
# Grant access based on the tag, not the specific column list —
# new columns tagged 'sensitivity=high' are covered automatically,
# the same operational value as ABAC in the Databricks series
lf_client.grant_permissions(
Principal={'DataLakePrincipalIdentifier': 'arn:aws:iam::123:role/pii-access-role'},
Resource={
'LFTag': {'TagKey': 'sensitivity', 'TagValues': ['high']}
},
Permissions=['SELECT']
)The meaningful difference from Unity Catalog worth flagging explicitly: Lake Formation’s column masking is less dynamic than Unity Catalog’s function-based masking — Unity Catalog can apply arbitrary transformation logic (partial redaction, hashing) based on group membership evaluated at query time, while Lake Formation’s model is closer to binary column-level access grants. For AWS architectures needing Unity Catalog-style dynamic masking, this typically requires an additional layer (a view with CASE WHEN masking logic, evaluated against current_user via Redshift or Athena's session context) built on top of Lake Formation's coarser access grants.
Orchestrating the Complete Pipeline with Step Functions
Blog 11’s state machine patterns assemble the full Medallion pipeline into one orchestrated, observable execution.
{
"StartAt": "IngestToBronze",
"States": {
"IngestToBronze": {
"Type": "Task",
"Resource": "arn:aws:states:::glue:startJobRun.sync",
"Parameters": {"JobName": "bronze-ingestion"},
"Retry": [{
"ErrorEquals": ["States.TaskFailed"],
"MaxAttempts": 3, "IntervalSeconds": 60
}],
"Next": "TransformToSilver"
},
"TransformToSilver": {
"Type": "Task",
"Resource": "arn:aws:states:::glue:startJobRun.sync",
"Parameters": {"JobName": "silver-transform"},
"Catch": [{
"ErrorEquals": ["States.ALL"],
"Next": "NotifyValidationFailure"
}],
"Next": "BuildGoldAthena"
},
"BuildGoldAthena": {
"Type": "Task",
"Resource": "arn:aws:states:::athena:startQueryExecution.sync",
"Parameters": {
"QueryString": "INSERT INTO gold.daily_revenue_by_region SELECT ...",
"WorkGroup": "scheduled-etl"
},
"Next": "NotifySuccess"
},
"NotifySuccess": {
"Type": "Task",
"Resource": "arn:aws:states:::sns:publish",
"End": true
},
"NotifyValidationFailure": {
"Type": "Task",
"Resource": "arn:aws:states:::sns:publish",
"End": true
}
}
}Why this orchestration structure matters beyond “running the jobs in order”: the Retry on Bronze ingestion handles transient S3/network issues (Blog 11's transient-failure pattern). The Catch on Silver transformation routes to an alert path specifically because Silver's validation failures (from the code shown earlier) are permanent, logic-driven failures, not something a retry would fix — the exact Retry-vs-Catch distinction from Blog 11, applied at the layer-boundary level.
Architecture Flow: The Complete AWS Medallion Pipeline
Data Sources (APIs, databases, event streams)
|
+-- Kinesis/Firehose (Blog 8) - streaming
+-- Lambda/Glue (Blog 5, 10) - batch
|
v
S3 BRONZE (append-only, versioned,
schema-flexible, Blog 2's layout)
|
Glue Data Catalog registration
(crawler or explicit, Blog 5/12)
|
v Step Functions orchestrated
(Blog 11: Retry for transient)
Glue Job - deduplication, validation,
type casting (fail loudly on
quality breach)
|
v Step Functions orchestrated
(Blog 11: Catch on validation failure)
S3 SILVER (Parquet, partitioned, Blog 2)
|
+----------+----------+
v v
Athena CTAS Redshift COPY
(BI dashboards, (high-concurrency,
moderate frequency, complex joins,
Blog 12) Blog 6)
| |
+----------+----------+
v
S3/Redshift GOLD (consumer-optimized,
separate objects per pattern)
|
Lake Formation governance
(LF-Tags, column/row permissions)
|
+----------+----------+
v v
BI Dashboards ML Training
(Athena/Redshift) (Spark/SageMaker
reading S3 directly)Failure Modes You’ll See in Production
Folder structure mistaken for architecture. The opening scenario. S3 prefixes named bronze/silver/gold with no schema enforcement, no validation, no versioning, and no governance layer — the naming implies structure that was never actually built, and the gap surfaces only when bad data propagates without anything catching it.
Bronze bucket without versioning, an overwrite destroys replay capability. A well-intentioned “cleanup” script overwrites what should be an append-only Bronze location. Without S3 versioning enabled, the previous data is unrecoverable, and the entire replay-from-Bronze safety net the Databricks series emphasizes is gone.
Silver validation implemented as a separate downstream check instead of inline. A data quality Glue job runs after the Silver write completes, checking for issues after the fact. In the window between the write and the check, downstream consumers (including a Gold CTAS job that happens to run on a tight schedule) may have already read and propagated the bad data before the validation job even executes.
Gold built as one table trying to serve both BI and ML. Following directly from the Databricks series’ warning, a single Gold table optimized for BI dashboard aggregation is also used as an ML training source, and the aggregated data lacks the row-level granularity ML feature engineering actually needs — the same anti-pattern, same fix (separate Gold objects per consumer), now expressed in AWS-specific service terms.
Lake Formation permissions granted at the S3 bucket level instead of through Lake Formation itself. A team grants IAM permissions directly on the S3 bucket for a Gold table, bypassing Lake Formation’s governance layer entirely. Lake Formation’s column masking and LF-Tag policies never apply, because the access path went around Lake Formation via direct S3 permissions — the AWS equivalent of Databricks’ external table security gap from the Databricks series’ security article.
Step Functions Retry configured on a Glue job that fails due to a genuine bug. Following Blog 11’s exact warning, the Silver transformation’s Retry policy attempts a broken transformation three times before finally reaching the Catch block — wasting pipeline time on every failed run because the failure was a code bug, not a transient issue that Retry could resolve.
Trade-offs: What This Architecture Optimizes For
This architecture optimizes for:
- Clear separation of concerns at each layer, with AWS services matched to what each layer actually needs (Blog 7’s framework applied systematically)
- Governance enforced through Lake Formation rather than assumed from folder structure
- Cost efficiency through deliberate compute service selection per transformation, not a single service used for everything
This architecture doesn’t optimize for:
- Simplicity of initial setup — correctly implementing contracts at each boundary requires more upfront work than “three S3 folders and a Glue job”
- Unity Catalog’s dynamic, function-based column masking — Lake Formation’s model requires additional layering for equivalent flexibility
- A single unified namespace the way Unity Catalog’s three-level catalog.schema.table provides natively — AWS requires more deliberate naming conventions across Glue Catalogs
The honest trade-off: building a genuinely enforced Medallion architecture on AWS requires assembling more individual pieces than Databricks’ more opinionated platform provides natively. The payoff is the same architectural benefit — replayability, correctness guarantees, and governed serving — achieved through AWS-native primitives that a team already invested in the AWS ecosystem can operate without adopting an additional platform.
Real-World Constraints
Glue Data Catalog and Lake Formation must be enabled and configured deliberately. Unlike Unity Catalog, which is Databricks’ default governance model, Lake Formation requires explicit setup — registering S3 locations, migrating from pure IAM-based S3 access to Lake Formation-mediated access. Existing AWS data lakes often have years of IAM-only access patterns that need active migration to benefit from Lake Formation’s governance layer.
Cross-account Medallion architectures compound Blog 3’s IAM patterns. A Medallion architecture spanning multiple AWS accounts (common in larger organizations separating raw ingestion from processed data by account boundary) requires the cross-account IAM and Lake Formation cross-account sharing patterns, adding real configuration complexity beyond a single-account implementation.
Schema evolution at Silver still requires the same operational discipline as the Databricks series. Nothing about AWS’s specific services removes the fundamental Silver schema stability principle — adding a column to Silver still requires either reprocessing Bronze data or accepting NULLs for historical records, exactly as covered in the Databricks series’ Medallion article.
What This Means for the Rest of the Series
Blog 14 (Modern data lake pattern): extends this
architecture with the
broader reference
pattern AWS publishes,
showing where this
Medallion implementation
fits within it
Blog 17 (Lake Formation deep dive): goes significantly
deeper on the
governance layer only
introduced here
Blog 20 (Production checklist): includes Medallion-specific
items (versioning enabled,
validation inline, Lake
Formation properly mediating
access) as part of the
pre-launch checklist
Summary: The Engineering Lesson
A Medallion architecture is not a storage layout. It’s a set of enforced contracts at layer boundaries — and every AWS service choice in this article exists to implement one of those contracts concretely, not to fill in a diagram template.
The six months of undetected duplicate revenue from the opening scenario happened because the team built the diagram without building the enforcement. S3 buckets named correctly. Arrows drawn correctly. Nothing underneath actually checking that Bronze was complete, that Silver was correct, or that Gold served its consumers appropriately.
The Databricks series established the contracts. This article shows they’re portable — the same architectural discipline, implemented through S3 versioning, Glue validation logic, Lake Formation governance, and Step Functions orchestration instead of Unity Catalog and Lakeflow Jobs. The platform changes. The engineering discipline that makes the architecture actually work doesn’t.
Next in Series
Blog 14 - The AWS Modern Data Lake: Architecture That Actually Scales
This article built one complete Medallion pipeline. Blog 14 zooms out to AWS’s broader reference architecture for data lakes at scale — where this pipeline fits, how multiple pipelines and consumer patterns coexist in one platform, and where the reference architecture’s clean diagram breaks down under real production load.
We’ll go deep on the specific scaling constraints (crawler frequency across dozens of tables, Lake Formation permission management at scale, cross-team Gold layer ownership) that only appear once a single pipeline becomes a genuine multi-team data platform.
Comment Below
What’s the gap you’ve seen between an AWS data lake’s architecture diagram and what was actually enforced in production?
Was it S3 folders named bronze/silver/gold with no schema validation, no versioning, and no governance behind the naming? A Gold table trying to serve both BI dashboards and ML training with neither working well? Lake Formation set up on paper but bypassed by direct S3 IAM permissions that nobody cleaned up?
And what finally exposed the gap between the diagram and the reality?
Tags: aws-data-engineering, medallion-architecture, data-lake, glue-data-catalog, lake-formation, step-functions, bronze-silver-gold, dataforge