Data Lakes on the Cloud (S3 + Glue)
From 'files in a bucket' to 'tables you can govern'
A cloud lake is object storage plus a metastore, a schema-on-read layer and governance: S3 + Glue (or GCS + Dataproc metastore) turning raw files into queryable tables.
What you will learn
- Explain how a metastore (Glue/Hive) turns object prefixes into queryable tables
- Set up a schema-on-read lake with raw, trusted and curated zones
- Secure the lake with Lake Formation-style policies and audit logs
What is this?
A cloud data lake layers three services over object storage: a metastore (Glue catalog, Databricks metastore) that maps prefixes → tabular schema, a processing engine (Spark, Athena, Glue jobs) that reads/writes open formats, and a governance layer (Lake Formation, IAM, audit) controlling access. Classic architecture uses zones: raw (landing exactly-as-received), trusted (validated/dedup'd) and curated (modeled for consumption).
Why do you need it?
- You keep raw data forever at object-storage cost and define structure at read time.
- glue/CSV/Parquet/JSON can all coexist — schema evolves without rewriting history.
- One metastore means Athena, Spark and warehouses share the same tables/views.
- Zone separation keeps 'original evidence' from 'analytics opinions' with clear policy boundaries.
Mental model
A library: stacks of books plus a card catalogue
Storage + metastore = a lake
Books (objects) in the stacks (bucket); the catalogue (metastore) says which shelf holds '2030 tax returns' and what format they're in. You can re-catalogue without moving a book.
How it works
- Write zone: files land in s3://lake/raw/{source}/dt=<day>/ in open formats.
- Register tables: Glue crawlers or deploy-time SQL create catalog entries pointing at prefixes.
- Schema-on-read: the catalog defines the view; files can be re-interpreted without transformation.
- Evolve: add columns/partitions; old objects stay untouched and readable under the new catalog definition.
- Govern: Lake Formation/IAM grant table-and-column access; audit logs record every read.
- Curate: Spark/Glue jobs write trusted/curated zones (dedupe, validate, model) as new catalog tables.
Zone-based cloud lake: raw → trusted → curated with a shared metastore.
In production
- A streaming pipelander writes click events to lake/raw/clickstream and a nightly Spark job dedupes them into trusted/clickstream_dedup, registered as a Glue table.
- A pharma firm keeps every clinical raw file forever for auditors, while curated aggregate tables are column-restricted so researchers can't touch PII.
- A retailer uses Glue crawlers to auto-register new SaaS export folders so the catalog is fresh without manual SQL.
Best practices
- Standardize zones (raw/trusted/curated) and a partition convention as code, not habit.
- Register tables at deploy time, not with a dreaded 'cluster of crawlers doing chaos' at midnight.
- Put partitioning, compression and schema evolution conventions into the pipeline template.
- Enable access/audit logs on the lake — governance questions arrive faster than you think.
Common mistakes
- Treating the metastore as optional — no catalog means every consumer re-invents the schema.
- Crawling-and-never-updating, so catalog partitions point at deleted files and queries break.
- Raw zone written directly by ad-hoc scripts nobody owns, breaking reproducibility.
- Column-level security ignored, so 'single team owns the lake' fails the first compliance review.
Debugging tips
- table exists but shows zero rows → partitions registered but files live under an unregistered prefix.
- 'Schema mismatch' between engine and files → catalog definition vs Parquet schema drifted (re-run the register job).
- Query cost spike → a partition column moved out of the path so pruning gagged.
- Access denied but file is public → the metastore/Lake Formation policy differs from bucket policy.
Interview checkpoint
Hands-on lab
- Model raw/trusted/curated zones as object prefixes
- Implement a metastore mapping prefixes to schemas
- Register partitions and run a table read through it
Simulate a Zones-and-Metastore Lake
30 min · beginner
Quick quiz
Which component turns object prefixes into queryable tables in a lake?
Schema-on-read means you can re-interpret old raw files without rewriting them.