Enforcing Minimum and Maximum Data Retention
This lesson explains how each storage service enforces retention so that data is kept exactly as long as required, and how data is moved securely when it changes location.
Learning outcomes
After completing this lesson, you will be able to:
- Identify the retention mechanism of each service.
- Identify the services that move data securely between locations.
- Enforce both a minimum and a maximum retention period.
Retention by service
Retention requirements cut both ways: data must be kept for a minimum period and deleted when that period ends, and each service has its own mechanism. In S3, lifecycle rules move objects to cheaper storage classes and expire current versions, noncurrent versions and delete markers. Combined with Object Lock default retention, they guarantee a minimum period as well as eventual deletion. EFS lifecycle policies move files that are not accessed to the Infrequent Access and Archive storage classes. FSx takes automatic daily backups with configurable retention, or uses AWS Backup.
CloudWatch Logs has a retention setting on each log group; the default is never to expire, so it should be set deliberately. AWS Backup lifecycle rules delete recovery points when their retention ends. The following table summarises the mechanisms.
| Service | Mechanism |
|---|---|
| S3 | Lifecycle rules transition classes and expire current versions, noncurrent versions and delete markers; pair with Object Lock default retention for a minimum period |
| EFS | Lifecycle policies to Infrequent Access and Archive |
| FSx | Automatic daily backups with configurable retention, or AWS Backup |
| CloudWatch Logs | Retention settings per log group |
| AWS Backup | Lifecycle rules delete recovery points when retention ends |
Retention mechanisms
Moving data securely
Data often has to move during its lifecycle: from on-premises systems to AWS, between Regions for disaster recovery, or into a separate account for backups and records. Each transfer must preserve confidentiality and integrity, and copies must be protected as strongly as the source. The following list describes the services used for secure transfers.
- DataSync: TLS-encrypted transfer with integrity verification between on premises, other clouds and AWS.
- S3 Replication: copies to other Regions or accounts, optionally changing ownership to the destination; Replication Time Control for an SLA.
Moving data securely
Minimum and maximum retention
Compliance often sets both a minimum and a maximum. Object Lock or Backup Vault Lock enforces the minimum, so data cannot be deleted early; lifecycle expiration enforces the maximum, so personal data is not kept longer than the law allows.
The following diagram shows the minimum and maximum on one record's timeline.

Minimum or maximum retention?
Minimum and maximum retention for personal data
Customer records must be kept for at least five years for financial regulation and deleted after six for privacy law. Object Lock enforces the minimum and a lifecycle rule enforces the maximum:
aws s3api put-object-lock-configuration --bucket acme-customer-records --object-lock-configuration \
'{"ObjectLockEnabled":"Enabled","Rule":{"DefaultRetention":{"Mode":"COMPLIANCE","Years":5}}}'
aws s3api put-bucket-lifecycle-configuration --bucket acme-customer-records --lifecycle-configuration '{
"Rules": [{ "ID": "six-year-maximum", "Status": "Enabled", "Filter": {},
"Expiration": { "Days": 2190 },
"NoncurrentVersionExpiration": { "NoncurrentDays": 1 } }]
}'Records cannot be deleted before five years, and expire after six. The CloudWatch Logs groups that hold application logs with customer data receive matching retention settings, so no copy outlives the policy.
How are rarely used EFS files moved to cheaper storage?
Show answer
With an EFS lifecycle policy.
Exam Tips
Remember for the exam
- To delete data automatically after its retention period, use S3 Lifecycle expiration.
- To move rarely used EFS files to cheaper storage, use an EFS lifecycle policy.
- For encrypted, verified transfer of files to AWS, use DataSync.
- To replicate objects to another account and change their ownership, use S3 Replication.
- Enforce minimum retention with Object Lock and maximum retention with lifecycle expiration.