Protecting Lake Data with Versioning, Object Lock and Replication
This lesson explains how S3 versioning, Object Lock and replication protect data in a lake against mistakes, malicious deletion and the loss of a Region, and copy it to other accounts.
Learning outcomes
After completing this lesson, you will be able to:
- Describe how versioning, Object Lock and replication protect data.
- Distinguish governance mode from compliance mode.
- Manage the cost of versioning with lifecycle rules.
The features
Several S3 features protect data and copy it elsewhere. Versioning keeps every version of an object, so an overwritten or deleted object can be recovered; a delete only adds a delete marker on top. Versioning is a prerequisite for replication and Object Lock. Object Lock makes object versions write once, read many (WORM), so they cannot be changed or deleted during a retention period, which meets regulatory record-keeping requirements and protects against ransomware.
Same-Region and Cross-Region Replication copy new objects automatically to buckets in the same or another Region or account, for compliance, lower latency elsewhere or disaster recovery. Replication Time Control adds a guarantee that 99.99% of objects are copied within 15 minutes. Replication applies only to new objects, so S3 Batch Replication copies objects that existed before it was configured. The following table summarises the features.
| Feature | What it does |
|---|---|
| Versioning | Keeps every version; a delete adds a delete marker. Required for replication and Object Lock |
| Object Lock | WORM (write once, read many) storage with retention in governance or compliance mode, plus legal holds |
| Same-Region and Cross-Region Replication | Copies objects to other buckets or accounts for compliance, latency or DR; Replication Time Control adds a 15-minute SLA |
| S3 Batch Replication | Replicates objects that existed before replication was configured |
Protection and replication
Object Lock modes
Object Lock protection differs in who can remove it early. In governance mode, most users cannot delete or change a locked version, but users granted s3:BypassGovernanceRetention can. This suits internal policies and testing retention settings. In compliance mode, nobody, not even the root user, can delete the version or shorten its retention until the period ends, which is what regulations requiring immutable records need. A legal hold protects a version with no expiry date, for example during litigation, until a user with s3:PutObjectLegalHold removes it. The following table summarises the settings.
| Setting | Who can remove protection early |
|---|---|
| Governance mode | Users with the s3:BypassGovernanceRetention permission |
| Compliance mode | Nobody, including the root user, until the retention period ends |
| Legal hold | Users with s3:PutObjectLegalHold; no expiry date |
The following diagram shows the protections on a bank's trade record bucket and its replica.

Object Lock modes
Versioning and cost
Versioning keeps every version of an object: overwriting creates a new version, and deleting adds a delete marker while the old versions remain. This protects against accidental overwrites and deletions, because any earlier version can be restored.
The cost is that storage grows silently. A data lake that rewrites files frequently, for example during compaction or Iceberg maintenance, can accumulate many times its visible size in noncurrent versions. A lifecycle rule that permanently deletes noncurrent versions after a suitable period, such as 30 days, keeps the protection against recent mistakes while controlling cost.
The following diagram shows how versions accumulate and how a lifecycle rule removes them.

Versioning costs
Protecting regulated records
A bank must keep trade records unaltered for seven years, protect them from deletion by any user, and hold a copy in a second Region. The bucket is configured as described in the following table.
| Requirement | Configuration |
|---|---|
| Records cannot be changed or deleted for seven years | Object Lock in compliance mode, seven-year default retention |
| Prerequisite for Object Lock and replication | Versioning enabled |
| Copy in a second Region within 15 minutes | Cross-Region Replication with Replication Time Control |
| Records under investigation kept beyond retention | Legal holds on the affected objects |
Governance mode would not meet the requirement, because users with a bypass permission could delete records. In compliance mode, not even the root user can shorten the retention.
What must be enabled on a bucket before Object Lock or replication can be used?
Show answer
Versioning.
Exam Tips
Remember for the exam
- To prevent deletion during a retention period, use Object Lock.
- Compliance mode cannot be bypassed, even by the root user.
- Replication and Object Lock require versioning.
- To replicate existing objects, use S3 Batch Replication.
- Expire noncurrent versions with a lifecycle rule to control versioning cost.