S3 Lifecycle rule precedence - multiple rules or just one?

0

Hi community

If I have an S3 bucket with 2 lifecycle rules, which:

  • one rule looks for a tag to expire objects after 90 days
  • another rules looks for a different tag to transition an object to glacier after 7 days

How does that take precedence? If i'm at day 10 after the object creation (it was created with all the corresponding tags) shouldn't it be transitioned to glacier? And when day 90 arrives should it be deleted?

Not sure if the rule setup is ok, maybe I should consolidate in one rule with 2 actions?

Thanks! Eric

asked 2 months ago151 views
1 Answer
3
Accepted Answer

Hello Eric,

If an object meets the criteria of both rules, the action specified in the first rule (transition to Glacier after 7 days) will take precedence, and the object will be transitioned to Glacier after 7 days. The expiration action specified in the second rule (after 90 days) will not be applied to this object because it has already been transitioned to Glacier.

To achieve the desired behavior, you can consolidate both actions into a single lifecycle rule with multiple actions. You can define a single rule with two actions: one to transition the object to Glacier after 7 days and another to expire the object after 90 days. This consolidation ensures that both actions are applied sequentially in the desired order.

With this consolidated rule, objects with the specified tag will be transitioned to Glacier after 7 days and then expired after 90 days if they have not already been deleted or transitioned

Hope it clarifies and if does I would appreciate answer to be accepted so that community can benefit for clarity, thanks ;)

profile picture
EXPERT
answered 2 months ago
profile picture
EXPERT
reviewed a month ago
  • Hi Adeleke, sounds great, I'll give it a try. Thank you very much for your help!

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions