Lesson 7 of 7 Amazon S3 Data Lakes

Deleting Personal Data from a Data Lake for Compliance

This lesson explains how to delete specific records from a data lake to honour erasure rights under regulations such as the GDPR and retention policies, which is harder than deleting a row from a database and must be designed for.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe the steps of a deletion request.
  • Explain how open table formats support row-level deletes.
  • Design a lake so that deletion is practical, including old object versions.

The steps of a deletion request

Privacy regulations give people the right to have their data deleted, and in a data lake, where data is copied and transformed many times, honouring that right takes several steps.

  1. Find every copy

    Use Amazon Macie to locate personal data, the Data Catalog to identify the tables, and lineage to follow the data into derived datasets.

  2. Delete the rows

    Delete or rewrite the affected rows; Apache Iceberg's DELETE makes this practical without rewriting whole tables by hand.

  3. Remove older copies

    Remove copies that still contain the data: Iceberg snapshots, S3 object versions, replicas, backups and derived datasets built from the original.

  4. Record the deletion

    Record what was deleted and when, as evidence for audits.

The following diagram shows the steps and what still holds the data after each one.

The steps that make a deletion request complete. An Iceberg DELETE removes the customer's rows from the current table; expiring old snapshots and removing orphan files deletes the data files that still contain them; a lifecycle rule permanently deletes noncurrent S3 versions; and raw copies age out under a limited retention period or are deleted too.
The order of the last two steps can vary.

Why open table formats help

Plain Parquet files cannot be edited, so deleting one person's rows means finding and rewriting every affected file. Apache Iceberg supports row-level DELETE in Athena, Spark and Glue, and snapshot expiry then removes the old data files that still contain the deleted rows.

Put in order

Erasing one person's data

Exam skills 2.3.5 · 4.5.2

Put the steps of a right-to-erasure request in order.

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

Designing for deletion

Deletion is much easier when the lake is designed for it from the start. Personal data is kept in a limited number of tables, keyed by a person identifier, so a deletion affects a known set of tables rather than every dataset.

Most datasets replace direct identifiers with tokens, so that deleting the person's entry from the token mapping table effectively removes the link between them and every tokenised record. The raw zone, which holds unmasked data, has a limited retention period. And noncurrent S3 object versions and old Iceberg snapshots are expired on a schedule, so deleted data does not survive indefinitely in historical copies.

Select all that apply

Designing for deletion

Exam skills 2.3.5

Identify the design choices that make deletion requests easier.

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

Honouring a deletion request

A customer asks for their personal data to be deleted. Their records are spread across thousands of Parquet files in the lake, and the bucket has versioning enabled. The following table pairs each challenge with its approach.

ChallengeApproach
Parquet files cannot be edited in placeStore the table in Apache Iceberg and run DELETE WHERE customer_id = ...
Old data files still hold the recordsExpire old Iceberg snapshots and remove orphan files
S3 versioning keeps previous object versionsLifecycle rule permanently deleting noncurrent versions after a short period
Raw zone copiesRaw data is kept for a limited retention period, or deletion is applied there too

Plain Parquet would require rewriting every affected file by hand. Open table formats make row-level deletes routine, which is why they are the usual answer for privacy deletion in data lakes.

Check yourself

After an Iceberg DELETE, why can the deleted rows still exist in S3?

Show answer

Older snapshots still reference the data files that contain them. Expiring the snapshots removes those files.

Exam Tips

Remember for the exam

  • To delete specific rows in a lake for GDPR, use Iceberg DELETE, then expire snapshots.
  • Remember object versions, replicas, backups and derived datasets when deleting.
  • Use Macie, the Data Catalog and lineage to find every copy of personal data.
  • Tokenising identifiers limits how many datasets a deletion affects.
  • Lifecycle expiration enforces retention periods automatically.