Skip to content

S3 lifecycle rule for a specific Object.

0

S3 lifecycle rule for a specific Object.

I have an S3 bucket with a folder named temp/ that contains multiple objects. Is it possible to create a lifecycle policy to transition specific objects within this folder to the Standard-IA storage class? Specifically, I want to apply the policy to objects whose names start with template- (e.g., temp/template-file1, temp/template-xyz). Can I use a filter condition like temp/template-* in the lifecycle rule to achieve this? In my all object I didn`t add any tag so I cant use tag based filtering.

asked 10 months ago256 views
1 Answer
0
Accepted Answer

Yes, it is possible to create a lifecycle policy to transition specific objects within the temp/ folder to the Standard-IA storage class based on their object names. You can use a prefix filter in your S3 Lifecycle configuration to achieve this.

To target objects whose names start with "template-" within the "temp/" folder, you would use the prefix "temp/template-" in your lifecycle rule. This prefix will match objects like "temp/template-file1" and "temp/template-xyz" as you described.

Here's how you can set up such a rule:

  1. In your S3 Lifecycle configuration, create a new rule.
  2. For the rule scope, choose to limit the scope using filters.
  3. Add a prefix filter with the value "temp/template-".
  4. Set up the transition action to move objects to the Standard-IA storage class after the desired number of days (remember, objects must be at least 30 days old before transitioning to Standard-IA).

This approach allows you to target specific objects within the temp/ folder without relying on tags. The rule will apply to all objects that match the specified prefix, allowing you to manage the lifecycle of these particular objects separately from others in the bucket.

Keep in mind that there's a minimum storage duration of 30 days for objects before they can be transitioned to Standard-IA. Also, objects smaller than 128 KB are not transitioned by default, but you can modify this behavior if needed.

By using this prefix-based filter in your lifecycle rule, you can effectively manage the storage class transitions for your specific template files within the temp/ folder.
Sources
Setting an S3 Lifecycle configuration on a bucket - Amazon Simple Storage Service
Transitioning objects using Amazon S3 Lifecycle - Amazon Simple Storage Service
Examples of S3 Lifecycle configurations - Amazon Simple Storage Service

answered 10 months ago
EXPERT
reviewed 10 months ago
  • how much time it will take to implement the rule for ex if I am using Transition to Intelligent-Tiering Days after objects become noncurrent is 1 atlest 1 day utc midnight time?

  • Lifecycle rules are evaluated as of the situation at midnight in the UTC time zone and will take a variable amount of time to complete, generally mostly depending on the number of objects requiring processing. If an object becomes noncurrent at 14:00 UTC on Monday, for example, and your lifecycle rule is set to transition objects 1 day after becoming noncurrent, that object will become eligible for transition at 14:00 UTC on Tuesday -- and not yet at midnight on Tuesday. This will cause the transitioning to start at midnight, 0:00 UTC on Wednesday, and takes at least a few hours to complete.

  • Also note that transitioning actions can be set to happen zero days after the object was created or became noncurrent. Expiration actions require a minimum of 1 day, but transitioning actions do not. In the above example case, setting the delay to zero days would allow the object to be transitioned already on Tuesday at midnight UTC.

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.