The Problem
You store patient imaging files in S3 Standard. Regulations require 7-year retention. The access pattern is well-defined:
- First 90 days: actively accessed
- 90 days to 2 years: rarely accessed but needs immediate retrieval
- After 2 years: never accessed but must remain retrievable for compliance audits
- After 7 years: must be deleted
You want to minimize costs while fully automating the data lifecycle.
The Solution
Create a single S3 lifecycle rule with three transitions and an expiration:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
aws s3api put-bucket-lifecycle-configuration \
--bucket patient-imaging-bucket \
--lifecycle-configuration '{
"Rules": [
{
"ID": "PatientImagingLifecycle",
"Status": "Enabled",
"Filter": {
"Prefix": "imaging/"
},
"Transitions": [
{
"Days": 90,
"StorageClass": "STANDARD_IA"
},
{
"Days": 730,
"StorageClass": "GLACIER"
}
],
"Expiration": {
"Days": 2555
}
}
]
}'
How It Works
The lifecycle rule automates the entire 7-year journey:
1
2
3
4
Day 0-90: S3 Standard ($0.023/GB/month) — frequent access
Day 91-730: S3 Standard-IA ($0.0125/GB/month) — rare access, instant retrieval
Day 731-2555: S3 Glacier ($0.0036/GB/month) — compliance archive
Day 2556: Permanently deleted — retention period met
Cost Savings Example
For 1 TB of imaging data over 7 years:
| Strategy | 7-Year Cost |
|---|---|
| All S3 Standard | ~$1,932 |
| Tiered lifecycle (Standard → IA → Glacier → Delete) | ~$415 |
That is a 78% cost reduction with zero manual intervention.
Transition Constraints
S3 lifecycle transitions follow a waterfall model — you can only transition to a storage class that is lower in the hierarchy:
1
S3 Standard → Standard-IA → Intelligent-Tiering → One Zone-IA → Glacier Instant → Glacier Flexible → Glacier Deep Archive
Each transition must be to a class further down this chain. You cannot transition from Glacier back to Standard-IA using lifecycle rules.
Why Not the Alternatives?
Keep everything in S3 Standard — The most expensive option. For imaging data that is never accessed after 2 years, paying S3 Standard rates for the remaining 5 years is a massive waste.
Lambda function for transitions — S3 lifecycle policies are a native, fully managed feature that does exactly this. Writing custom Lambda code to replicate built-in functionality adds complexity, failure risk, and maintenance burden.
S3 Intelligent-Tiering — When the access pattern is this well-defined and predictable, lifecycle policies are cheaper. Intelligent-Tiering charges per-object monitoring fees and cannot automatically delete objects at a specific age — you still need a lifecycle rule for expiration.
Key Takeaways
- A single S3 lifecycle rule can define multiple transitions and an expiration in one configuration
- Transitions must follow the storage class hierarchy — you cannot move data back up
- For well-defined access patterns, multi-stage lifecycle policies are cheaper than Intelligent-Tiering
- The
Expirationaction permanently deletes objects — use it to enforce retention policies automatically - S3 Glacier Flexible Retrieval costs ~$0.0036/GB/month with 3-5 hour standard retrieval
Never miss a story from us, subscribe to our newsletter