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.