Lifecycle Rules
Inkwell now knows which storage class each invoice should be in, and it changes with age: hot for a month, cool for a year, frozen for years, then gone. Moving thousands of files by hand every month would never actually happen. A lifecycle rule writes that timeline down once and S3 follows it forever.
The rule
Write the timeline once: hot, cool, cold, gone.
A lifecycle rule has three parts:
- A filter: which objects it applies to, by key prefix, by tags, by object size, or the whole bucket.
- Transition actions: after N days, move matching objects to a colder class.
- Expiration actions: after N days, delete them.
Inkwell's rule for invoices:
Filter: prefix invoices/
Day 30: transition to S3 Standard-IA
Day 365: transition to S3 Glacier Deep Archive
Day 2555: expire (about seven years)Rules can also clean up two hidden costs:
- With versioning on, old versions pile up silently. Expire noncurrent versions after, say, 30 days.
- Large uploads that failed halfway leave invisible parts that are still billed. Abort incomplete multipart uploads after a few days.
Rules of the road:
- Transitions only flow downhill, to colder classes. No rule moves an object back to Standard; you would restore or copy it yourself.
- Objects must sit at least 30 days in their current class before a rule can move them to Standard-IA or One Zone-IA.
- By default, objects smaller than 128 KB are not transitioned, because the move would cost more than it saves.
- S3 applies rules in the background, so an action may happen a little after the exact day.
The shortcut
Draw the object's life as a timeline of four stops, hot, cool, cold, gone, write the day each stop begins, then translate each stop into one action. Skip any stop the data does not need.
Hot: days 0 to 30
Customers check recent invoices often. Stay in Standard; no action needed.
The trap is expiring the wrong prefix. An expiration rule with no filter applies to the whole bucket, covers included. Always check the filter before saving.
Drills
Answer fast — trust the rule.
What does an expiration action do?
Can a lifecycle rule move objects from Glacier Deep Archive back to S3 Standard?
Inkwell saves a rule with an expiration at day 90 and no filter. What does it affect?
Which rule action removes the hidden cost of half-finished large uploads?
Remember
- Write the timeline once: hot, cool, cold, gone.
- Filter, then transitions (downhill only), then expiration; add noncurrent-version and incomplete-upload cleanup.
- Trap: a rule without a filter touches the whole bucket.
