Representative interview topic

System design interview: How would you build object discovery with S3 Metadata tables?

System designHard
Offer.cc Editorial TeamPublished Updated

Question

A data platform must find unencrypted, expiring, or recently deleted S3 objects and support audit queries. How would you design S3 Metadata tables, backfill, querying, and recovery?

Problem and scope

S3 Metadata tables provide tabular object metadata for a general purpose bucket: a journal table records object and metadata changes, while a live inventory table backfills a snapshot of existing objects. The question tests combining events and snapshots, latency and consistency, access control, cost, and recovery; its category is system-design. It is not a strongly consistent external index of every S3 request.

What the interviewer is testing

Explain the roles of journal and inventory, first backfill impact, deletion and lifecycle events, querying the Iceberg tables, and handling delay, duplicates, and gaps. Cover table-bucket IAM, cross-account access, sensitive metadata, partitioning and scan cost, retention, and rebuild procedures.

Clarifying questions

  • Do queries need current state, change history, or both?
  • What discovery delay is acceptable, and must deletion or lifecycle transition be real time?
  • What are object count, daily change volume, query dimensions, and retention period?
  • Who may read metadata, including tenant, encryption, tag, or custom fields?
  • Is cross-account or cross-Region use required, or only one AWS account?
  • What is the recovery-time objective if the table configuration is deleted or backfill fails?

A 30-second answer framework

“Use inventory to establish the current-object baseline and journal to track later changes; make snapshot and history guarantees explicit in the query contract. During backfill expose incomplete status, deduplicate consumers by event time and object version, and alert on lag and gaps. Restrict reads with table-bucket resource policies, prune common queries, and model storage, scan, and per-object costs. If configuration is lost, preserve source S3 and audit exports, rebuild from versioned configuration, and reconcile the baseline.”

Step-by-step answer

Step 1: Define the data-product boundary

Make “current catalog” and “change log” separate query contracts. The catalog finds unencrypted or expiring objects; the journal triggers governance and audit workflows. Downstream systems should not treat an event table as a gap-free current-state table.

Step 2: Design backfill and cutover

Create the configuration and observe inventory backfill before exposing queries that claim full coverage. During backfill classify objects as covered, pending, or failed for retry, so an unscanned object is not reported as absent. Connect journal as an incremental source only after the baseline is ready.

Step 3: Merge snapshots and events

Make processing idempotent with object key, event time, and event type. Keep audit records for deletion, overwrite, and lifecycle changes. Consumers should replay the journal and periodically reconcile with inventory, repairing gaps rather than resetting the index blindly.

Step 4: Protect access and sensitive fields

Use IAM resource policies on the table bucket and tables to restrict principals, prefixes, and operations. Authorize tenant, tag, and encryption fields by data class, and return only required columns. For cross-account use, define bucket ownership, query-cost ownership, and revocation propagation.

Step 5: Control cost and recover from failure

Partition or materialize derived tables for common filters, limiting full scans and frequent ad-hoc queries. Track journal, inventory, scan volume, and per-object cost. If a configuration is deleted, a Region is unsupported, or the service fails, retain source events and exported snapshots, rebuild from versioned configuration, and reconcile again.

Model answer

“I would treat inventory as the existing-object baseline and journal as the change source, with explicit latency and consistency guarantees for each query. After enabling the configuration, I would monitor backfill and publish no full-coverage conclusion until it finishes; then merge idempotently by object key, event time, and type, with periodic inventory reconciliation. I would separately limit table-bucket IAM, sensitive fields, cross-account costs, and query scans. During failure, preserve source S3 and audit exports, rebuild from configuration, and verify gaps instead of treating the metadata tables as a strongly consistent index.”

Common mistakes

  • Treating journal as a snapshot → replay or loss creates wrong state → reconcile with inventory and maintain derived state.
  • Publishing compliance results before backfill completes → unscanned objects look absent → expose backfill status and coverage.
  • Ignoring overwrite and deletion order → an old event overwrites new state → use event time, type, and idempotency keys.
  • Granting everyone table-bucket read access → sensitive metadata leaks → authorize by principal, column, and tenant.
  • Watching storage only → scans and per-object fees run away → monitor volume, frequency, and total cost.
  • Resetting the index after configuration loss → audit lineage and gaps disappear → version rebuilds from retained sources and reconcile.

Follow-up questions

Follow-up 1: How do journal and inventory work together?

Inventory supplies a snapshot of existing objects; journal records later changes. Build the baseline from inventory, apply journal changes, and periodically reconcile with a new inventory to correct missing or duplicate events.

Follow-up 2: How do you detect incomplete backfill?

Track backfill status, coverage, and failures and propagate incomplete state to the query layer. Full-coverage conclusions wait for completion or explicitly mark results as incomplete.

Follow-up 3: How do you handle duplicate events?

Generate an idempotency key from object key, event time, event type, and available version information. Duplicate consumption becomes a no-op; uncertain ordering is corrected by snapshot reconciliation.

Follow-up 4: When should you avoid S3 Metadata tables?

If the business needs millisecond-level read-after-write consistency, complex transactional joins, or fully custom field governance, evaluate a dedicated index or database. Metadata tables fit object discovery, audit, and batch governance sources.

Public sources

Related questions

Related interview tool

Use Solve for a system design answer

Clarify the requirements first, then move through scale, architecture, component choices, and trade-offs.

View the tool