Lesson 5 of 6 Data Integrity, Backup and Retention

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.

ServiceMechanism
S3Lifecycle rules transition classes and expire current versions, noncurrent versions and delete markers; pair with Object Lock default retention for a minimum period
EFSLifecycle policies to Infrequent Access and Archive
FSxAutomatic daily backups with configurable retention, or AWS Backup
CloudWatch LogsRetention settings per log group
AWS BackupLifecycle rules delete recovery points when retention ends
Match the pairs

Retention mechanisms

Exam skills 5.2.3

Match each service with its retention mechanism.

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

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.
Scenario questions

Moving data securely

Exam skills 5.2.4

Choose the transfer service for each need.

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

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.

Enforcing both ends of a retention rule. Object Lock in compliance mode for five years enforces the minimum, and a lifecycle rule expiring objects after 2,190 days enforces the six-year maximum; log groups holding customer data receive matching retention, so no copy outlives the policy.
The timeline is drawn to scale.
Sort into groups

Minimum or maximum retention?

Exam skills 5.2.3

Decide whether each control enforces a minimum or a maximum retention.

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

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.

Check yourself

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.