Blog >

Data Lake Architecture on AWS: S3, Glue, and Athena

Posted by Hadi @draft1 | November 3, 2026

Data Lake Architecture on AWS: S3, Glue, and Athena

A data lake on AWS is a storage-and-query pattern that uses S3 for durable object storage, Glue for cataloging and ETL, and Athena for serverless SQL queries without managing servers. This combination lets teams store structured, semi-structured, and unstructured data cheaply and query it on demand, rather than pre-loading everything into a fixed-schema warehouse.

This pattern has become the default starting point for analytics on AWS since the mid-2010s, and by 2026 it remains the most common first architecture engineers reach for when asked to "build a data lake." It's not the only option — Redshift, Lake Formation, EMR, and third-party lakehouse formats like Apache Iceberg and Delta Lake all play a role — but the S3/Glue/Athena trio is the cheapest way to get a working, queryable lake running in an afternoon.

In this article you'll get a concrete reference architecture, the specific configuration decisions that matter (partitioning, file formats, Glue crawler behavior, Athena workgroups), cost and performance trade-offs, and where this stack starts to break down so you know when to reach for something heavier.

What S3, Glue, and Athena Actually Do

S3 stores the raw bytes, Glue stores the metadata and runs transformation jobs, and Athena executes SQL against both using the open-source Presto/Trino engine. None of the three services know anything about your data until you tell them — the "lake" is really just a convention layered on top of object storage.

Concretely:

  • Amazon S3 holds files in buckets and prefixes (effectively folders). It has no concept of rows, columns, or schemas — it's just key-value object storage with 99.999999999% durability (11 nines) as stated in AWS's S3 design documentation.
  • AWS Glue Data Catalog is a managed Hive-metastore-compatible metadata store. It maps S3 paths to table definitions — column names, types, partition keys — so that query engines know how to interpret the files.
  • Glue Crawlers scan S3 prefixes, infer schema from file formats (CSV, JSON, Parquet, ORC, Avro), and populate or update the Data Catalog automatically.
  • Glue Jobs (Spark or Python Shell based, and now increasingly Ray-based as of Glue 5.0) do the actual ETL: reading raw data, cleaning it, converting formats, and writing it back to S3 in a curated zone.
  • Amazon Athena is a serverless query engine built on Trino. You point it at a Glue Catalog table and it issues distributed queries directly against S3 objects, billing per terabyte scanned.

The key architectural insight: storage and compute are fully decoupled. You pay for S3 storage continuously, but you only pay for Glue and Athena compute when a crawler runs or a query executes. This is the opposite of a traditional data warehouse, where compute and storage are bundled into a running cluster.

Reference Architecture: The Three-Zone Lake

A data lake answer worth quoting: most production AWS data lakes use a three-zone (or "medallion") layout — raw, curated, and consumable — with Glue jobs moving data between zones and Athena querying the final layer.

A typical layout looks like this:

s3://company-datalake-raw/        <- landing zone, immutable, source format
s3://company-datalake-curated/    <- cleaned, deduplicated, Parquet, partitioned
s3://company-datalake-consumption/ <- aggregated, business-logic applied, query-optimized

Data flow:

  1. Ingestion — sources (application databases via AWS DMS, Kinesis Data Streams, application logs, SaaS exports) land in the raw zone, typically in their native format (JSON, CSV) and untouched.
  2. Cataloging — a Glue Crawler runs on a schedule (or is triggered by an S3 event via EventBridge) to register new partitions and detect schema drift in the raw zone.
  3. Transformation — Glue ETL jobs (Spark) read raw data, apply schema enforcement, deduplicate, handle late-arriving data, and write out as Parquet with Snappy compression into the curated zone, partitioned by a sensible key (commonly date).
  4. Serving — a second crawler (or the same Glue job writing directly to the catalog via enableUpdateCatalog) registers curated tables. Athena, QuickSight, or Redshift Spectrum query this layer.
  5. Consumption — further aggregation jobs produce small, pre-joined tables for dashboards, cutting scan costs for high-frequency BI queries.

This mirrors the "bronze/silver/gold" medallion naming popularized by Databricks, though AWS documentation generally just calls it raw/trusted/curated or raw/stage/analytics — the naming doesn't matter, the separation of concerns does.

File Format and Partitioning: Where Most of the Cost Lives

Query cost and speed in Athena are driven almost entirely by file format, compression, and partitioning — not by cleverness in SQL. Athena bills $5 per terabyte scanned (US East, as published on the AWS Athena pricing page), so every design decision here is really a cost decision.

Key choices:

  • Columnar formats win. Parquet or ORC let Athena skip entire columns it doesn't need. A SELECT customer_id, amount FROM orders against Parquet reads only those two columns' data; against CSV it reads every byte of every row.
  • Compression matters, but pick splittable codecs. Snappy (used by default in most Glue Parquet writes) is splittable and fast to decompress. Gzip is not splittable, which hurts parallelism for very large files.
  • Partition by a column you actually filter on. Partitioning by year/month/day only helps if queries include a WHERE clause on date. Over-partitioning (e.g., partitioning by customer_id with millions of distinct values) creates the "small files problem" and blows up Glue Catalog metadata, slowing both crawlers and query planning.
  • File size target: 128 MB–1 GB per file. Too many small files (a common result of streaming ingestion writing one file per micro-batch) forces Athena/Trino to spend more time on file-open overhead than on scanning. AWS's own Athena performance tuning guidance recommends compacting small files periodically, e.g., with a scheduled Glue job or S3 Lifecycle-driven batch compaction.
  • Use partition projection instead of a Glue Crawler for high-cardinality, predictable partitions. Partition projection (an Athena feature) computes partition locations from a naming convention instead of looking them up in the Glue Catalog, which avoids the metadata overhead entirely for tables with thousands of partitions.

A rough illustration of the cost impact of format alone, based on AWS's published benchmark in its "Top 10 Performance Tuning Tips for Athena" documentation:

Format Relative Data Scanned Relative Query Cost Typical Use
CSV (uncompressed) 100% (baseline) 100% Raw landing zone only
CSV (gzip) ~30% ~30% Legacy exports
Parquet (Snappy) ~2–7% ~2–7% Curated/consumption zones
ORC (Zlib) ~2–7% ~2–7% Alternative to Parquet, Hive-heavy shops

These are directional, not guaranteed, numbers — actual savings depend heavily on column selectivity and row width — but the order of magnitude (converting CSV to Parquet routinely cuts scan costs by 90%+) is consistent with what AWS and most practitioner case studies report.

Glue Crawlers vs. Writing the Catalog Directly

Crawlers are convenient but not free, and they can silently get your schema wrong — for high-throughput or fast-changing tables, writing to the Glue Catalog explicitly from your ETL job is usually more reliable. Crawlers infer schema by sampling files, and schema inference can misfire: a crawler might see a few integer-looking strings and type a column as bigint, then choke on a later file with a mixed value in the same column, creating a new, slightly different table version or a string fallback that breaks downstream SQL.

Practical guidance:

  • Use crawlers for initial discovery of unfamiliar datasets, or for low-frequency, slowly-evolving sources.
  • Use Glue job catalog updates (enableUpdateCatalog=true with explicit catalogSchema) or the Glue Catalog API/Boto3 directly when you control the ETL job and want deterministic schema.
  • Set crawler schedules to match data arrival patterns — running a crawler hourly against a table that updates once a day wastes crawler run minutes and can create unnecessary partition churn.
  • Enable schema versioning in the Data Catalog so you can see and roll back unwanted schema changes.
  • For streaming or CDC sources (e.g., DMS-replicated RDS tables), consider AWS Glue Data Catalog's built-in schema evolution rules (ignore, merge, or add new columns) instead of letting a crawler recreate the table structure each run.

Security, Governance, and Access Control

A data lake without access control is a data liability, and the standard AWS answer is AWS Lake Formation layered on top of S3, Glue, and IAM. Lake Formation adds table- and column-level (and in many regions, row-level) permissions on top of the Glue Catalog, so you're not forced to manage access purely through S3 bucket policies and prefix structure.

Baseline controls worth implementing from day one:

  • S3 bucket policies and IAM for coarse-grained access (who can read/write which buckets).
  • Server-side encryption — SSE-S3 by default, SSE-KMS where you need audit trails on key usage and customer-managed key rotation.
  • Lake Formation permissions for fine-grained, table/column-level grants, especially useful when multiple teams query the same curated zone but shouldn't see all columns (e.g., PII fields).
  • VPC endpoints for S3 and Glue (Gateway and Interface endpoints respectively) so traffic between Athena/Glue and S3 doesn't traverse the public internet.
  • AWS CloudTrail and Athena query logging to know who queried what — important for compliance frameworks like SOC 2 or HIPAA where you must audit data access, not just storage.
  • Tag-based access control via Lake Formation LF-Tags, which scales better than per-table grants once you have hundreds of tables.

Where This Stack Starts to Strain

The S3/Glue/Athena combo is excellent for append-heavy, read-mostly analytical workloads, but it struggles with frequent updates, deletes, and strict transactional guarantees — that's the gap table formats like Apache Iceberg, Delta Lake, and Apache Hudi were built to close.

Plain Parquet-on-S3 has no native support for:

  • Row-level updates or deletes (needed for GDPR "right to be forgotten" requests, or correcting bad records) without rewriting entire partitions.
  • ACID transactions across concurrent writers — two Glue jobs writing to the same partition at the same time can corrupt or duplicate data.
  • Time travel / rollback to a previous table state.
  • Schema evolution that's fully safe across engines (adding a column is usually fine; renaming or changing types is risky).

Apache Iceberg (which AWS now supports natively in Athena, Glue, and EMR as of Glue 4.0+) solves these by maintaining a metadata layer of manifest files that track which data files belong to which table snapshot. Athena can run MERGE INTO, DELETE, and UPDATE against Iceberg tables directly — something that's simply not possible against a plain Hive-style Parquet table without rewriting files manually.

Capability Plain S3 + Parquet + Hive table S3 + Apache Iceberg table
Row-level UPDATE/DELETE Not supported natively Supported via Athena MERGE/DELETE
ACID transactions No Yes, snapshot isolation
Schema evolution Manual, error-prone Built-in, safe column add/rename
Time travel queries No Yes, query by snapshot ID or timestamp
Query engine maturity Very mature, widest tool support Mature in Athena/Glue/EMR; some third-party tools catching up
Operational complexity Lower Higher (compaction, snapshot expiration jobs needed)

The trade-off is operational: Iceberg tables need periodic maintenance (compacting small files, expiring old snapshots, removing orphan files) or they degrade in performance and accumulate storage cost. AWS Glue added auto-compaction for Iceberg tables as a managed feature, which reduces but doesn't eliminate this burden.

Athena Engine Versions and Workgroups

Athena's engine version and workgroup configuration directly affect both query capability and cost control, and most teams under-configure both. Athena runs on Trino under the hood, and AWS periodically ships new "engine versions" (Athena engine v3 has been the default since 2023, built on a newer Trino base) that add functions, improve join performance, and support features like Iceberg's MERGE INTO.

Workgroups are the main cost-control lever:

  • Set a per-query data scan limit on a workgroup so a single bad SELECT * on an un-partitioned CSV table can't rack up a huge bill.
  • Use separate workgroups per team or project to track cost attribution via Cost Explorer, since workgroup usage shows up as a dimension in billing data.
  • Enable query result reuse (Athena caches results for identical queries within a configurable TTL, up to 60 minutes by default settings) to avoid re-scanning data for dashboards that refresh frequently with the same query.
  • Store query results in a dedicated S3 bucket with a lifecycle rule to expire old result sets — they accumulate silently and add to storage cost.

Key Takeaways

  • S3 is the storage layer, Glue is the metadata/ETL layer, and Athena is the query layer — they're decoupled, so you pay for compute only when crawlers run or queries execute.
  • File format and partitioning drive Athena cost far more than SQL tuning; converting CSV to partitioned, Snappy-compressed Parquet commonly cuts scan costs by 90% or more.
  • Glue Crawlers are convenient for discovery but can misinfer schema; for production pipelines you control, write to the Glue Catalog explicitly from your ETL job.
  • Lake Formation adds table- and column-level permissions on top of IAM and S3 bucket policies — necessary once more than one team shares a lake.
  • Plain S3 + Parquet has no native support for row-level updates, deletes, or ACID transactions; Apache Iceberg (now natively supported in Athena and Glue) closes that gap at the cost of added operational maintenance.
  • Athena workgroups with per-query scan limits are the simplest guardrail against runaway query costs.
  • Small files are the silent killer of lake performance — compact regularly, whether through scheduled Glue jobs or Iceberg's auto-compaction.

Frequently Asked Questions

What's the difference between a data lake and a data warehouse on AWS?

A data lake (S3/Glue/Athena) stores data in open file formats with schema applied at query time ("schema-on-read"), while a warehouse like Amazon Redshift stores data in a proprietary, optimized columnar format with schema enforced at load time ("schema-on-write"). Lakes are cheaper and more flexible for diverse, semi-structured, or exploratory data; warehouses typically deliver faster, more predictable performance for repeated BI queries against well-modeled data. Many architectures use both — a lake for raw and exploratory data, with curated subsets loaded into Redshift via Redshift Spectrum or COPY.

Do I need Glue, or can Athena query S3 directly?

Athena always needs a table definition from the Glue Data Catalog (or a compatible Hive metastore) — it can't query raw S3 objects with no metadata at all. You can create that table definition manually with a CREATE TABLE DDL statement in Athena itself without ever running a Glue Crawler, which is a common shortcut for stable, well-known schemas.

How much does an S3/Glue/Athena data lake cost?

Costs come from three independent meters: S3 storage (around $0.023/GB/month for S3 Standard, per AWS's published pricing), Glue (crawler and ETL job run-time, billed per DPU-hour), and Athena ($5 per terabyte scanned, per AWS's Athena pricing page). A well-partitioned, Parquet-based lake queried occasionally can cost a few dollars a month in query charges; a poorly partitioned CSV lake queried frequently can cost hundreds.

Is Athena good for real-time dashboards?

Athena is not designed for sub-second, high-concurrency interactive dashboards — typical query latency ranges from under a second to tens of seconds depending on data volume and partitioning, and it's not built for thousands of concurrent users. For real-time or high-concurrency BI, many teams put a Redshift cluster, Redshift Serverless, or a pre-aggregated QuickSight SPICE dataset in front of the lake instead.

Should I use Apache Iceberg from the start?

Not necessarily — if your workload is append-only (logs, events, immutable records), plain partitioned Parquet is simpler to operate and has the widest tool compatibility. Reach for Iceberg (or Hudi/Delta Lake) when you need row-level updates/deletes, concurrent writers, or time travel, since AWS Glue and Athena now support Iceberg natively without extra infrastructure.

How do I handle schema changes in source data?

Use Glue Catalog schema versioning and configure explicit evolution rules (add new columns, ignore unexpected ones, or fail the job) rather than letting a crawler silently redefine the table. For Iceberg tables, schema evolution (adding, renaming, or widening columns) is handled safely by the table format itself without rewriting existing data files.

Can I query data in a data lake from Redshift?

Yes, via Redshift Spectrum, which lets a Redshift cluster query external tables registered in the same Glue Data Catalog that Athena uses, without loading the data into Redshift first. This is a common pattern for joining frequently-accessed warehouse tables with large, infrequently-queried historical data sitting in S3.


Draw this in seconds with draft1. Describe your architecture in plain English and draft1 generates an editable AWS/cloud diagram plus documentation — no dragging boxes around. Try it free.

Draw this in ~20 seconds

Describe your own version of this architecture and draft1 generates an editable draw.io diagram — boxes, arrows, labels, the lot.

Generate this diagram free ➔

Free demo — no signup. Then 3 free diagrams with an account, no card.