S3 LifeCycle rules with tag filters

0

I want to transition the storage class not only after a certain amount of days, but also when the object is ready to be transitioned. Which could be several days.

My idea is to use Tag filters:

  • Transition after 1 day
  • Prefix: my-files/
  • Tag: Ready:Yes

On object creation, no Tags are applied to the object. On day N+1 the object isn't transitioned, since the tag rule doesn't match

On day 7, I add the tag "Ready:Yes"

Will the object transition on day 8 (last_modified>1 and tag=Ready:Yes) or will it not, since the process scanning files to be transferred will not list my object since it's age is more than 2?

Or another way to phrase my question: will all the objects present in the bucket be evaluated every day to see if they are eligible for a Lifecycle Rule? Or are objects flagged as ineligible the first time and never re-evaluated again?

Thanks Daniel

profile picture
asked a year ago1362 views
1 Answer
0
Accepted Answer

Amazon S3 will evaluate the object's LastModifiedDate to determine if the object is eligible for transitition. The LastModifiedDate is based on when the body of the object was last modified. Adding tags to an object will not cause the LastModifiedDate to reset. Additionally, Amazon S3 will scan you bucket daily to evaluate if an object is eligible for a Lifecycle Rule.

Objects eligible for transitioning via a Lifecycle Rule due not contain any additional headers. However, objects eligible for expiration via a Lifecycle Rule will contain an additional "Expiration" header. You can perform a HeadObject API call these objects to see if Amazon S3 has evaluated the object and determined if it's eligible for expiration. You can use this behavior to test out your use case by loading test objects into a prefix and configuring a Lifecycle Rule to expire objects within that prefix. Then, on the day you want to expire the object, you can add the required tags to the object and then wait for a bit and then perform HeadObject call. You will see that the object has been evaluated by Amazon S3 and has determined that the object is eligible for expiaration by viewing the "Expiration" header.

profile pictureAWS
answered a year ago

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