Luke
Luke

Reputation: 161

Is it possible to create multiple prefix in AWS S3 LifeCycle

In AWS life cycle management , can we create one rule with multiple prefix . I went through this blog https://docs.aws.amazon.com/AmazonS3/latest/dev/manage-lifecycle-using-dot-net.html

but this documentation shows example of only one rule and one prefix

is there any other way i can create multiple prefix by having only one rule.

There is one more option like Tag , which i don't know how it works or can it be helpful in achieving my goal

Thanks in advance

Upvotes: 2

Views: 2966

Answers (1)

Tamás Sallai
Tamás Sallai

Reputation: 3365

You can use one prefix per rule, but you can add multiple rules with only the prefixes changed. There is even an example in the aws docs:

<LifecycleConfiguration>
    <Rule>
        <Filter>
           <Prefix>projectA/</Prefix>
        </Filter>
        transition/expiration actions.
         ...
    </Rule>

    <Rule>
        <Filter>
           <Prefix>projectB/</Prefix>
        </Filter>
        transition/expiration actions.
         ...
    </Rule>
</LifecycleConfiguration>

Tagging means you can attach tags to objects and the lifecycle rule will apply to objects that have that particular tag. From the same docs:

<LifecycleConfiguration>
    <Rule>
        <Filter>
           <Tag>
              <Key>key</Key>
              <Value>value</Value>
           </Tag>
        </Filter>
        transition/expiration actions.
        ...
    </Rule>
</LifecycleConfiguration>

In this case, the rule is effective for objects that have key=value tags. More info: https://docs.aws.amazon.com/AmazonS3/latest/dev/object-tagging.html

Upvotes: 3

Related Questions