Ref: https://learn.cantrill.io/courses/1820301/lectures/41301486
S3 Lifecycle Management, Configuration, and Rules
Diagram: https://github.com/acantril/aws-sa-associate-saac03/blob/main/0700-SIMPLE_STORAGE_SERVICE(S3)/00_LEARNINGAIDS/S3LifeCycle.png
- 🔧 Set of rules that automatically transition or expire objects/versions in a bucket after a given time → optimize costs in a large bucket
- Rules consist of actions that are based on conditions
- Rules apply to a bucket or groups of objects (prefix- or tags-defined groups)
- Action types
- Transition actions
- e.g. move objects to a different storage class 30 days after they were created
- Expiration actions
- e.g. delete previous versions on the first of each month
- ‼️ Conditions NOT based on access/usage!! → Use instead S3 Intelligent-tiering for that!
- Rules apply regardless of access/usage (e.g. move all objects to cold storage on a given date, regardless of usage)
- Use if objects have a very predictable and defined behavior
- Transitions between storage classes follow waterfall-paradigm:
- Std → Std-IA → Intelligent-Tiering → 1Z-IA → Glacier-IR → Glacier-FR → Glacier-DA
- 💡 Note the placement of Intelligent-Tiering
- Objects in classes to the left can transition to any of classes on the right
- ‼️ Important EXCEPTION: can't transition from 1Z-IA to Glacier-IR!
- Usually lifecycles go through all the different tiers instead of skipping tiers, but it's possible to skip them
- ❗ Lifecycle transitions can NOT happen upward/to the left, ONLY down/to the right…
- ‼️ …But you can always manually change the storage class of given object(s)! Lifecycle transitions can't move from Std-IA to Std, but you can always do that yourself via AWS Management Console, CLI, etc.
- Lifecycle Transitioning Considerations:
- Be careful when transitioning from Std to Std-IA, 1Z-IA or IT → smaller objects can cost more!
- âť—Â An object must stay in Std at least 30 days before transitioning to Std-IA or 1Z-IA
- 💡 Again, you can manually migrate to an IA class any time, but with lifecycle configuration you must wait 30 days at least
- âť—Â If the same rule that transitions from Std to Std-IA/1Z-IA then transitions objects from IA classes to Glacier classes, those objects must stay an additional 30 days in IA classes before transitioning to Glacier classes
- ‼️ Only applies if single rule! With 2 rules you can circumvent that! (quirks…)