Lesson 1 of 2 Open Table Formats and AWS Lake Formation

Managing Lake Tables with Apache Iceberg and Amazon S3 Tables

This lesson explains how open table formats such as Apache Iceberg make data lakes behave like databases, with transactions, updates and history, while keeping data in open files on S3 that many engines can read.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe how Iceberg tracks snapshots in metadata.
  • Use Iceberg features such as MERGE, time travel and schema evolution.
  • Describe what Amazon S3 Tables manage automatically.
  • Maintain self-managed Iceberg tables with compaction and snapshot expiry.

How Iceberg works

An Iceberg table is a set of data files (Parquet, ORC or Avro) plus metadata files recording the schema, partitioning and a list of snapshots. Each write creates a new snapshot atomically, so readers always see a consistent table and concurrent writers cannot corrupt it: ACID transactions.

The following diagram shows the layers of an Iceberg table.

The structure of an Iceberg table. The catalogue points to the table's current metadata file, which lists the schema, partitioning and snapshots. Each snapshot lists, through manifests, the data files that make up the table at that moment. A write adds files and a new snapshot, then swaps the catalogue pointer atomically, so readers always see a complete snapshot.
File names are illustrative.

Iceberg features

Apache Iceberg is an open table format that tracks a table's files in metadata, adding database-like behaviour to data stored in S3. It supports row-level changes in SQL with INSERT, UPDATE, DELETE and MERGE INTO, so applying change data capture or correcting records no longer means rewriting whole partitions. Schema evolution adds, renames or drops columns safely without rewriting data.

Hidden partitioning partitions by a transform of a column, such as the day of a timestamp, so queries filter on the column itself, and partition evolution changes the partitioning for new data without rewriting old data. Every commit creates a snapshot, which enables time travel, querying the table as it was at a snapshot or time, and rollback to undo a bad load. The following table summarises the features.

FeatureWhat it gives you
INSERT, UPDATE, DELETE, MERGE INTORow-level changes and upserts in SQL
Schema evolutionAdd, rename or drop columns without rewriting data
Hidden partitioningPartition by a transform such as day(timestamp) without partition columns in queries
Partition evolutionChange partitioning without rewriting old data
Time travel and rollbackQuery or restore the table as of a snapshot or timestamp

Athena, Glue, EMR, Redshift, Data Firehose (streaming writes), SageMaker Unified Studio and Lake Formation all work with Iceberg tables in the Glue Data Catalog. Apache Hudi and Delta Lake are alternatives supported by Glue and EMR.

The following diagram shows the snapshots that successive MERGE batches create in an Iceberg table.

Each MERGE of a CDC batch commits a new snapshot of the orders table. Readers see either the whole batch or none of it, FOR TIMESTAMP AS OF lets analysts query yesterday's state, and a bad load can be rolled back to the previous snapshot.
The batch times are illustrative.
Match the pairs

Iceberg features

Exam skills 2.1.7 · 2.4.2

Match each requirement with the Iceberg feature.

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

Amazon S3 Tables

Running Iceberg tables in ordinary S3 buckets requires regular maintenance: compacting small files, expiring old snapshots and removing files that no table version refers to any longer. Without it, query performance degrades and storage costs grow. Amazon S3 Tables provide table buckets, a type of S3 bucket built specifically for Iceberg tables.

Table buckets offer higher transaction performance than general-purpose buckets and perform automatic maintenance, namely compaction, snapshot management and removal of unreferenced files, so teams do not need to schedule maintenance jobs. They integrate with the AWS Glue Data Catalog, so the tables can be queried by Athena, Redshift, EMR and other engines like any other catalogued table.

The following diagram compares table maintenance in each kind of bucket.

Maintaining Iceberg tables in a general-purpose bucket compared with S3 Tables. Self-managed tables need scheduled compaction, snapshot expiration and orphan file clean-up, or queries slow down and storage grows. Table buckets perform this maintenance automatically and integrate with the Glue Data Catalog.
Both hold standard Iceberg tables.
Scenario questions

S3 Tables or self-managed?

Exam skills 2.1.7

Choose where to store Iceberg tables.

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

Maintaining self-managed tables

Iceberg tables need regular maintenance. Frequent writes, especially from streams, create many small files, and compaction merges them into fewer large files so queries open fewer objects; it is run with Athena OPTIMIZE or Spark rewrite procedures. Every commit also keeps old snapshots and their files, so snapshot expiration removes snapshots older than the retention period, and orphan file clean-up deletes files no snapshot references, both done with Athena VACUUM. Glue Data Catalog optimisers can perform these tasks automatically, and S3 Tables performs them for you. The following table summarises the tasks.

TaskHow
Compaction (merge small files)Athena OPTIMIZE or Spark rewrite procedures
Snapshot expiration and orphan file clean-upAthena VACUUM
Automatic optimisationGlue Data Catalog optimisers
Match the pairs

Iceberg maintenance

Exam skills 2.1.7

Match each maintenance task with how it is done.

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

Applying CDC changes to a lake table

DMS writes inserts, updates and deletes from an orders database to S3 every few minutes. Analysts need a table that always shows each order's current state. With an Iceberg table, a scheduled job merges the latest changes:

MERGE INTO lake.orders t
USING (SELECT * FROM staging.order_changes WHERE batch_id = '2026-10-09T10:15') s
ON t.order_id = s.order_id
WHEN MATCHED AND s.op = 'D' THEN DELETE
WHEN MATCHED THEN UPDATE SET status = s.status, total = s.total, updated_at = s.updated_at
WHEN NOT MATCHED AND s.op <> 'D' THEN INSERT (order_id, status, total, updated_at)
  VALUES (s.order_id, s.status, s.total, s.updated_at);

Iceberg's ACID transactions mean readers never see a half-applied batch. Time travel (FOR TIMESTAMP AS OF) lets analysts see yesterday's state, and compaction keeps file counts healthy. With Amazon S3 Tables, compaction and snapshot expiry run automatically.

Check yourself

How can an Iceberg table's partitioning be changed without rewriting old data?

Show answer

With partition evolution: new data uses the new layout while old data keeps the old one.

Exam Tips

Remember for the exam

  • For upserts and deletes in the data lake, use Iceberg MERGE INTO and DELETE.
  • To query data as it was yesterday, use Iceberg time travel.
  • To change partitioning without rewriting old data, use partition evolution.
  • Managed Iceberg storage with automatic compaction is S3 Tables.
  • When an Iceberg table has too many small files, compact it with OPTIMIZE.