Skip to Content

Object Lock and Vault Lock

Write-once-read-many storage with S3 Object Lock (compliance and governance modes, retention periods, legal holds) and S3 Glacier Vault Lock.

What it is

Some data must never be changed or deleted for a period: financial records, medical images, audit logs. Regulations (such as SEC 17a-4 in the US) call this WORM storage: Write Once, Read Many. S3 offers two ways to get it.

S3 Glacier Vault Lock

Vault Lock applies to vaults in the original Amazon S3 Glacier service (a vault is Glacier's own container, separate from S3 buckets).

  1. A Vault Lock policy is created with WORM rules, such as "deny deleting archives younger than 365 days".
  2. The policy is locked. There are 24 hours to test it before confirming.
  3. Once locked, the policy can never be changed or deleted, not even by the root user.

It's helpful for compliance and data retention.

Updated since the slides

The original vault-based Amazon Glacier service is no longer accepting new customers. New designs use the S3 Glacier storage classes in normal S3 buckets, protected with S3 Object Lock. Vault Lock can still appear on the exam as "the WORM option for Glacier vaults".

S3 Object Lock

S3 Object Lock: in governance mode only users with the s3:BypassGovernanceRetention permission can delete a locked version; in compliance mode no one can, not even the root user, until the retain-until date; a legal hold blocks deletion until someone with s3:PutObjectLegalHold removes it S3 Object Lock: in governance mode only users with the s3:BypassGovernanceRetention permission can delete a locked version; in compliance mode no one can, not even the root user, until the retain-until date; a legal hold blocks deletion until someone with s3:PutObjectLegalHold removes it

Three ways to stop a version being deleted.

S3 Object Lock adopts the WORM model for objects in S3 buckets. It blocks an object version from being deleted or overwritten for a set amount of time. Versioning must be enabled. Locks apply to versions: uploading the same key just adds a new version, and the locked one stays.

Retention modes

  • Compliance mode:
    • the object version can't be overwritten or deleted by any user, including the root user;
    • the retention mode can't be changed, and the retention period can't be shortened.
  • Governance mode:
    • most users can't overwrite or delete the version or change its lock settings;
    • some users with special permission (s3:BypassGovernanceRetention) can change the retention or delete the object.
  • Retention period: protects the object version for a fixed period (until a retain-until date). It can be extended, never shortened in compliance mode.
  • Legal hold:
    • protects the object version indefinitely, independent of any retention period;
    • can be freely placed and removed by users with the s3:PutObjectLegalHold IAM permission.

A default retention can also be set on the bucket, applied to every new object.

Real-world examples

  • A broker-dealer stores trade records in a bucket with Object Lock in compliance mode for 7 years. Not even AWS support or the root user can delete them early.
  • A company uses governance mode for backups: protected from accidental deletion and ransomware, but a security admin can still remove a mistaken upload.
  • A lawsuit requires keeping certain emails. The legal team puts legal holds on them until the case ends, then removes the holds.

Exam tips

  • "WORM", "regulatory retention", "no one can delete, not even root" → S3 Object Lock in compliance mode.
  • "Prevent deletion but let a few admins override" → governance mode.
  • "Keep an object indefinitely for a lawsuit, no fixed date" → legal hold.
  • "WORM for a Glacier vault" → Glacier Vault Lock.
  • "Object Lock prerequisite" → versioning enabled.

Common traps

  • "The root user can delete an object in compliance mode." No one can, until the retention ends.
  • "Shorten a compliance-mode retention period." Only extending is allowed.
  • "A legal hold expires after the retention period." It has no expiry; someone must remove it.

Check yourself

A compliance-mode lab would leave objects that can't be deleted (and must keep being paid for) until the retention ends, so instead:

AWS documentation

On this page

Open notes

Spotted a mistake?

These notes are open source. Suggest a fix, or star the repo if they helped you.

Suggest an edit

For AI agents: llms.txt · llms-full.txt