Lesson 6 of 6 Amazon S3

Enforcing WORM Retention with S3 Object Lock

This lesson explains how S3 Object Lock stores objects in write-once-read-many (WORM) form, preventing deletion or overwriting for a retention period, for regulatory compliance and ransomware protection.

Learning outcomes

After completing this lesson, you will be able to:

  • Distinguish governance mode, compliance mode and legal holds.
  • Identify uses of Object Lock.
  • Describe a ransomware-resistant backup design.

Retention modes

S3 Object Lock stores object versions in a write-once-read-many model, so they cannot be overwritten or deleted during a retention period. In governance mode, most users cannot delete a protected version or shorten its retention, but users with the s3:BypassGovernanceRetention permission can, which protects against accidents while leaving an administrative escape.

In compliance mode, nobody, not even the root user, can delete the version or shorten its retention until the period ends, which meets regulatory record-keeping rules and protects backups from ransomware. A legal hold has no expiry date: it prevents deletion until a user with s3:PutObjectLegalHold removes it, independently of any retention period, for example while litigation is pending. The following table summarises the protections.

ModeWho can delete or shorten retention
GovernanceUsers with the special s3:BypassGovernanceRetention permission
ComplianceNobody, not even the root user, until the period ends
Legal holdAnyone with s3:PutObjectLegalHold can remove it; it has no expiry date

Object Lock requires versioning and protects individual object versions. A default retention period can be set on the bucket, and governance mode is useful for testing settings before committing to compliance mode.

The following diagram compares the two retention modes.

S3 Object Lock retention modes. In governance mode, most users cannot delete a protected version or shorten its retention, but users with s3:BypassGovernanceRetention can. In compliance mode, nobody, not even the root user, can do so until the period ends. A legal hold, with no expiry, can be applied in either case.
A legal hold works independently of either mode and stays until someone with s3:PutObjectLegalHold removes it.

Uses

S3 Object Lock stores objects in a write-once-read-many (WORM) model, preventing them from being deleted or overwritten for a retention period or while a legal hold is in place. Its first use is regulatory: regulations such as SEC Rule 17a-4, FINRA and CFTC require certain records to be kept in immutable form, and Object Lock in compliance mode has been assessed against those requirements.

Its second use is protection: backups and logs locked with Object Lock cannot be destroyed by ransomware or a malicious insider, even one with administrative credentials, until their retention period ends.

Scenario questions

Object Lock modes

Exam skills 1.3.6 · 2.2.5

Choose the Object Lock protection for each requirement.

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

Ransomware-resistant design

Backups in S3 can be protected against ransomware by combining several controls, so that no single compromised credential can destroy every copy.

  1. Enable versioning and Object Lock on the backup bucket, so objects cannot be overwritten or deleted during their retention period.
  2. Replicate the data to a bucket in a separate, tightly controlled account that production administrators cannot access.
  3. Back up with AWS Backup into a vault protected by AWS Backup Vault Lock.

An attacker who obtains credentials for the source account can then encrypt or delete the live data, but cannot destroy the locked copies or the copies in the separate account.

Select all that apply

Ransomware-resistant backups

Exam skills 1.3.5 · 2.2.5

Identify the controls in a ransomware-resistant backup design.

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

Protecting data from deletion and disaster

A company's critical documents must survive accidental deletion, ransomware and the loss of a Region, and must be kept unchanged for seven years for compliance.

RiskFeature
Accidental deletion or overwriteVersioning
Malicious deletion, even by an administratorObject Lock in compliance mode, 7-year retention
Regional disasterCross-Region Replication to a bucket in another Region
Replication must finish within 15 minutesReplication Time Control
Old versions piling upLifecycle rules expiring noncurrent versions after the retention period

Versioning must be enabled before replication or Object Lock can be used. Replication applies only to objects written after it is configured; existing objects need S3 Batch Replication.

Check yourself

Which Object Lock mode prevents even the root user from deleting an object before its retention ends?

Show answer

Compliance mode. In governance mode, users with a special permission can still remove the retention.

Exam Tips

Remember for the exam

  • For regulatory WORM storage that even the root user cannot bypass, use Object Lock in compliance mode.
  • To allow administrators to override retention in exceptional cases, use governance mode.
  • To keep an object indefinitely during litigation, apply a legal hold.
  • To protect backups against ransomware, combine Object Lock with replication to a separate account.