Matt Winer
Matt Winer

Reputation: 535

Amazon S3 lifecycle rules - common prefix

I have an Amazon S3 bucket with a structure of:

-Events/
--01/
---435/
----002/
------HiRes/
------Preview/
------Thumbs/
---436/
----001/
------HiRes/
------Preview/
------Thumbs/
----002/
------HiRes/
------Preview/
------Thumbs/
.
.
.and so on

I only want to archive the objects that are in HiRes. Is it a matter of updating my lifecycle prefix to 'HiRes'?

The complete prefix of the "folder" I want to lifecycle is:

<bucketName>/Events/01/435/002/HiRes/

Upvotes: 0

Views: 1330

Answers (1)

Jatin Mehrotra
Jatin Mehrotra

Reputation: 11523

Is it a matter of updating my lifecycle prefix to 'HiRes'

No, you should mention the entire prefix whenever the prefix for HiRes changes ( in the case of 435 and 436). a rule applies to all objects that share the same prefix. for example 01/435/002/HiRes/ or 01/436/001/HiRes/ or 01/436/002/HiRes/

My suggestions would be to create a common prefix for your HiRes and structure would be something like common-for-HiRes/1, common-for-HiRes/2 and then apply a common lifecycle rule for common-for-Hires/ prefix

For Lifecycle action to a subset of objects based on different key name prefixes see this

UPDATE (based on comments) :-

if you cant change your directory structure, the try using tags or a combination of filter and tags whichever suits your case, example for above

Upvotes: 1

Related Questions