What you'll learn
- A rule has a filter (prefix, tags, size), and actions: transitions, expiration, noncurrent-version cleanup, and aborting incomplete uploads.
- Transitions to Standard-IA or One Zone-IA need objects to be at least 30 days old.
- S3 applies rules asynchronously; on versioned buckets, expiration adds a delete marker.
Section 01
Anatomy of a rule
Days counts from the object's creation. Rules apply to objects already in the bucket as well as new ones, and S3 evaluates them once a day, so an action can land a little after the exact day.
{
ID: "replays-archive",
Status: "Enabled",
Filter: { Prefix: "replays/" },
Transitions: [{ Days: 30, StorageClass: "STANDARD_IA" }],
Expiration: { Days: 365 },
AbortIncompleteMultipartUpload: { DaysAfterInitiation: 7 },
}Try it · A replay's year
Rule on replays/: Standard-IA at 30 days, expire at 365, abort unfinished uploads after 7.
Finished replay
STANDARD_IA
Cheaper storage, per-GB retrieval fee. Minimum 30 days here.
Upload that crashed on day 0
Aborted
Its parts were deleted on day 7. They never showed up in a listing, but you paid for them until then.
S3 runs lifecycle rules asynchronously; a transition or expiry can land a little after the exact day.
Section 02
Rules S3 enforces
- Objects must stay in STANDARD for at least 30 days before moving to STANDARD_IA or ONEZONE_IA; S3 rejects a rule with fewer days.
- Transitions only go “down” the ladder: STANDARD → IA → Glacier Instant → Glacier Flexible → Deep Archive.
- By default, objects smaller than 128 KB aren't transitioned — per-object transition charges would outweigh any saving.
- Each transition is billed as a request, so moving millions of tiny objects can cost more than it saves.
Section 03
Lifecycle and versioning
In a versioned bucket, Expiration doesn't delete data: it adds a delete marker and the old version becomes noncurrent. Pair it with NoncurrentVersionExpiration: { NoncurrentDays: 30 } to remove old versions after a grace period, and ExpiredObjectDeleteMarker to tidy up markers left with nothing behind them.
Practice
Your turn
Replays are watched a lot in their first month and rarely after. Move them to Standard-IA at 30 days, delete them after a year, and abort multipart uploads that never finished after 7 days. S3 rejects the transition as written — find out why.
Days, then add Expiration and AbortIncompleteMultipartUpload.Check
Check your understanding
Quick Quiz · one question, as many tries as you need.
logs/ to STANDARD_IA after 7 days. What happens when you save it?Choose one answer.