AWS - SOA-C02

πŸ—‚οΈ AWS SysOps SOA-C02 Exam Prep: S3 Object Lock & Versioning

πŸ“Œ What Is S3 Object Lock?

Amazon S3 Object Lock is a feature that prevents objects from being deleted or overwritten for a fixed or indefinite amount of time. It’s designed to help you meet regulatory requirements (like WORM β€” Write Once, Read Many) and protect critical data.

πŸ“– Object Lock Modes

There are two protection modes:

ModeDescription
Governance ModeProtects objects from most users, but AWS account root or special users can remove/reduce retention
Compliance ModeAbsolutely no one can delete or overwrite the object during the retention period

πŸ“– Retention Methods

TypeDescription
Retention PeriodSpecifies the number of days or a date until which the object cannot be deleted
Legal HoldSimilar to Compliance Mode, but flexible β€” holds objects indefinitely until removed

πŸ“Œ How to Enable Object Lock

  • When creating a bucket, enable “Object Lock” (must be done at bucket creation β€” cannot be enabled later)
  • Upload objects with lock configuration

AWS CLI Example:

aws s3api put-object-retention --bucket my-bucket --key myfile.txt --retention '{"Mode": "GOVERNANCE", "RetainUntilDate": "2025-12-31T00:00:00"}'

πŸ“Œ What Is S3 Versioning?

Amazon S3 Versioning enables you to keep multiple variants of an object in the same bucket.

Whenever you upload an object with the same key name:

  • A new version is created.
  • Previous versions are preserved.
  • You can retrieve, restore, or permanently delete specific versions.

πŸ“– How Versioning Works

ActionResult
Upload new object (same key)New version created, old version retained
Delete an objectA delete marker is added, older versions remain available
Restore a versionSpecify the version ID to retrieve an older version

AWS CLI Example:

aws s3api put-bucket-versioning --bucket my-bucket --versioning-configuration Status=Enabled

πŸ“– How Versioning & Object Lock Work Together

When both Versioning and Object Lock are enabled:

  • Each version of an object can have its own Object Lock configuration
  • Prevents accidental or malicious deletions of specific versions
  • Ensures regulatory compliance with WORM storage rules

πŸ“‘ Key Exam Scenarios (SOA-C02)

πŸ“ Scenario 1:
A company needs to prevent accidental deletion of S3 objects and maintain previous versions.
β†’ Use S3 Versioning

πŸ“ Scenario 2:
A company must store audit records in a WORM-compliant way for 7 years.
β†’ Use S3 Object Lock in Compliance Mode with a 7-year retention

πŸ“ Scenario 3:
An organization wants to prevent users from deleting critical data, but allow certain admins to override this protection when necessary.
β†’ Use S3 Object Lock in Governance Mode

πŸ“˜ Object Lock vs. Versioning Comparison

FeatureObject LockVersioning
PurposePrevents object deletion/overwriteKeeps multiple versions of objects
Protection LevelsGovernance / ComplianceN/A
Can Be Enabled After Bucket Creation?No (must be at bucket creation)Yes
Default RetentionOptional Retention / Legal HoldRetains all versions
Use CaseRegulatory WORM data protectionData recovery, rollback, auditing

βœ… Summary

  • S3 Versioning is for tracking and restoring object versions
  • S3 Object Lock is for protecting objects from deletion/overwrite
  • Use both together for secure, auditable, WORM-compliant storage
  • Remember Object Lock must be enabled when the bucket is created

29 Views

Leave a Reply

Your email address will not be published. Required fields are marked *