AWS Data Retention & Compliance Strategy Guide
Data retention policies
AWS Data Retention & Compliance Strategy Guide
This guide explores the mechanisms and policies required to manage data throughout its lifecycle in AWS, focusing on security, regulatory compliance, and cost optimization.
Learning Objectives
After studying this guide, you should be able to:
- Distinguish between S3 Object Lock Governance and Compliance modes.
- Implement WORM (Write Once Read Many) policies to meet regulatory requirements.
- Design S3 Lifecycle rules to automate data transitions and expiration.
- Explain the durability guarantees of AWS storage services (the "11 Nines").
- Select appropriate backup strategies based on RPO and RTO requirements.
Key Terms & Glossary
- WORM (Write Once Read Many): A data storage technology that allows data to be written to a storage medium once and prevents the drive from erasing or overwriting the data.
- Object Lock: An Amazon S3 feature that allows you to store objects using a WORM model to prevent deletion or overwriting for a fixed amount of time.
- Retention Period: The specific duration during which an object remains locked and cannot be deleted or overwritten.
- Legal Hold: An indefinite lock on an object that remains in effect until explicitly removed; it does not have an expiration date.
- Durability: The probability that data remains intact and accessible over time, without being lost or corrupted.
The "Big Idea"
[!IMPORTANT] Data management in the cloud is not a "set it and forget it" task. Effective Data Retention is the balance between Risk (keeping sensitive data too long), Compliance (meeting legal requirements like SOC or PCI), and Cost (moving older data to cheaper storage tiers). Use automation to ensure data is deleted the moment it is no longer required, yet protected with ironclad locks while it is.
Formula / Concept Box
| Feature | Governance Mode | Compliance Mode |
|---|---|---|
| Root User Access | Can delete if granted special IAM permissions | Cannot delete or overwrite under any circumstances |
| Permission Required | s3:BypassGovernanceRetention | None (Settings are immutable) |
| Primary Use Case | Protecting against accidental deletion by most users | Strict regulatory compliance (e.g., SEC Rule 17a-4) |
| Flexibility | Retention dates can be shortened or extended | Retention dates can only be extended |
Hierarchical Outline
- Data Classification
- Sensitivity Levels: Identifying PII, PCI, and SOC-relevant data.
- Regulatory Alignment: Mapping data to specific legal retention periods (e.g., 7 years for financial records).
- Amazon S3 Protection Mechanisms
- S3 Versioning: The prerequisite for Object Lock; maintains multiple variants of an object.
- WORM Policies: Implementing Object Lock at the bucket or object level.
- MFA Delete: Requiring a hardware token to permanently delete versions.
- Lifecycle Management
- Transitions: Moving data from S3 Standard → S3 Standard-IA → S3 Glacier.
- Expirations: Automatically deleting objects after a set period to reduce liability and cost.
- Database Retention (RDS/DynamoDB)
- Snapshots: Point-in-time backups with configurable retention (0–35 days for automated).
- Manual Snapshots: Retained until manually deleted, even if the database instance is terminated.
Visual Anchors
S3 Object Lock Workflow
Data Aging & Lifecycle Timeline
\begin{tikzpicture} [node distance=2cm] \draw[thick, ->] (0,0) -- (10,0) node[right] {Time}; \draw[fill=blue!10] (0,-0.5) rectangle (3,0.5) node[midway] {S3 Standard}; \draw[fill=green!10] (3,-0.5) rectangle (6,0.5) node[midway] {S3 Standard-IA}; \draw[fill=orange!10] (6,-0.5) rectangle (9,0.5) node[midway] {S3 Glacier}; \draw[fill=red!20] (9,-0.5) rectangle (10,0.5) node[midway] {Delete}; \node[below] at (0,-0.5) {Day 0}; \node[below] at (3,-0.5) {Day 30}; \node[below] at (6,-0.5) {Day 90}; \node[below] at (9,-0.5) {7 Years}; \draw[dashed] (1,0.5) -- (1,1.5) node[above] {Frequent Access}; \draw[dashed] (4.5,0.5) -- (4.5,1.5) node[above] {Infrequent Access}; \draw[dashed] (7.5,0.5) -- (7.5,1.5) node[above] {Archive}; \end{tikzpicture}
Definition-Example Pairs
- Lifecycle Transition Rule: An automated instruction to move data between storage classes.
- Example: Automatically moving raw logs from S3 Standard to S3 Glacier after 30 days to save 90% in storage costs.
- Governance Mode Bypass: A specific IAM permission that allows authorized administrators to delete locked objects in Governance mode.
- Example: A lead security engineer using
x-amz-bypass-governance-retention: trueto clean up a misconfigured test bucket.
- Example: A lead security engineer using
- Durability (11 Nines): AWS's design goal for S3 (99.999999999%).
- Example: If you store 10 million objects, you can expect to lose one object once every 10,000 years on average.
Worked Examples
Scenario: Compliance for Financial Audits
Goal: A fintech startup must ensure that all transaction records are unalterable for exactly 7 years to comply with local regulations.
Solution Steps:
- Enable S3 Versioning: This is required to use Object Lock.
- Enable S3 Object Lock: Set this during bucket creation.
- Apply Compliance Mode: Set a default retention period of 2,555 days (7 years).
- Verify: Test a deletion attempt with the Root user account. The attempt should fail with an "Access Denied" error.
Scenario: Log Retention and Cleanup
Goal: Store application logs for troubleshooting (30 days) and then archive them for security forensics (1 year), after which they must be deleted.
Solution Steps:
- Rule 1: Transition objects from S3 Standard to S3 Standard-IA after 30 days.
- Rule 2: Transition objects to S3 Glacier Flexible Retrieval after 60 days.
- Rule 3: Set an expiration date for 365 days after creation. S3 will automatically purge the files.
Checkpoint Questions
- What is the main difference between Governance mode and Compliance mode in S3 Object Lock?
- Which IAM permission is required to delete an object protected by Governance mode?
- True or False: S3 Object Lock can be enabled on a bucket that does not have versioning enabled.
- How many Availability Zones (AZs) does S3 Standard replicate data across to achieve high durability?
- If a legal team requires an object to be locked indefinitely for an ongoing investigation, which feature should be used?
▶Click to see answers
- In Governance mode, users with special permissions can still delete objects; in Compliance mode, NO ONE (including root) can delete the object until the retention period expires.
s3:BypassGovernanceRetention.- False. Versioning is a prerequisite for Object Lock.
- At least three AZs.
- Legal Hold.