S3 Lifecycle - Exclude Prefix


If I have a prefix Folder-1 which has a rule to keep contents live for 6 months and beyond 6 months to move the contents to Glacier. I would like to exclude Folder-1.1 and Folder-1.2 from this policy and have the data retained for 2 years. So, if I create an explicit rule on Folder-1/Folder-1.1 and Folder-1/Folder-1.2 to retain anything for 2 years, will the Glacier rule apply to all the rest of the folders except Folder-1.1 and Folder-1.2?

Prefix structure is as follows:

    |-- Folder-1.1
    |-- Folder-1.2
    |-- Folder-1.3
    |-- Folder-1.4

I don’t think S3 supports exclude rules currently in the Lifecycle management. Any recommendations on how this can be achieved?

asked 4 years ago5394 views
2 Answers
Accepted Answer

S3 is a key-value object storage service, there is no concept of ‘folder’ but 'prefix', for lifecycle rule if a rule is applied on a shorter prefix, it will take effect on the whole sub prefixes' objects, including 1.1 and 1.2. So yes applying the 1/ 'folder' will make 'folder' 1.1 and 1.2 being treated as the same as 1.3 and 1.4.

You can use object tag as the filter instead of prefix e.g creating a tag on all the objects with prefix 1/1.3 1/1.4 and use a single rule, or only applying lifecycle rules on 1/1.3 and 1/1.4.

answered 4 years ago

Is it possible to create the tag only for objects that should be excluded from file movement rules?

For example:

- folderA
------- file1
------- file2
------- file3
------- file4

If I want to exclude folder 1, I create the tag only on folder 1.

Can I use this approach? Or it is mandatory create a tag for each folders?


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