Lifecycle Policy With the Wasabi S3 API

Prev Next

The Lifecyle feature establishes a Lifecycle policy with rules to define actions that you want Wasabi to take during the life of an object. This feature replaces the need to manually delete an object after a retention period.

Configuring Lifecycle Settings

The lifecycle settings for a bucket are configured with the "put-bucket-lifecycle-configuration" command. For example:

$ aws s3api put-bucket-lifecycle-configuration --bucket 1-1-1-1 --endpoint-url https://s3.wasabisys.com --lifecycle-configuration file://lifecycle.json{

    "Rules": [
        {
            "Expiration": {
                "Days": 1
            },
            "ID": "lifecycle_rule_1",
            "Filter": {
                "And": {
                    "ObjectSizeGreaterThan": 1,
                    "ObjectSizeLessThan": 21474836480
                }
            },
            "Status": "Enabled"
        },
        {
            "Expiration": {
                "Days": 1
            },
            "ID": "object_lifecycle_rule_bucket_6807766",
            "Filter": {
                "Prefix": "1"
            },
            "Status": "Enabled"
        }
    ]}

Here is another example:

PUT https://s3.wasabisys.com/1-1-1-1?lifecycle
<LifecycleConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
    <Rule>
        <Expiration>
            <Days>1</Days>
        </Expiration>
        <ID>lifecycle_rule_1</ID>
        <Filter>
            <And>
                <ObjectSizeGreaterThan>1</ObjectSizeGreaterThan>
                <ObjectSizeLessThan>21474836480</ObjectSizeLessThan>
            </And>
        </Filter>
        <Status>Enabled</Status>
    </Rule>
    <Rule>
        <Expiration>
            <Days>1</Days>
        </Expiration>
        <ID>object_lifecycle_rule_bucket_6807766</ID>
        <Filter>
            <Prefix>1</Prefix>
        </Filter>
        <Status>Enabled</Status>
    </Rule>
</LifecycleConfiguration>

There is no response body for this call.

Retrieving Lifecycle Settings

The lifecycle settings for a bucket can be retrieved with the "get-bucket-lifecycle-configuration" command. For example:

$ aws s3api get-bucket-lifecycle-configuration --bucket 1-1-1-1 --endpoint-url https://s3.wasabisys.com{
    "Rules": [
        {
            "Expiration": {
                "Days": 1
            },
            "ID": "lifecycle_rule_1",
            "Filter": {
                "And": {
                    "ObjectSizeGreaterThan": 1,
                    "ObjectSizeLessThan": 21474836480
                }
            },
            "Status": "Enabled"
        },
        {
            "Expiration": {
                "Days": 1
            },
            "ID": "object_lifecycle_rule_bucket_6807766",
            "Filter": {
                "Prefix": "1"
            },
            "Status": "Enabled"
        }
    ]}

Here is another example:

GET https://s3.wasabisys.com/1-1-1-1?lifecycle
<?xml version="1.0" encoding="UTF-8"?>
<LifecycleConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
    <Rule>
        <Expiration>
            <Days>1</Days>
        </Expiration>
        <ID>lifecycle_rule_1</ID>
        <Filter>
            <And>
                <ObjectSizeGreaterThan>1</ObjectSizeGreaterThan>
                <ObjectSizeLessThan>21474836480</ObjectSizeLessThan>
            </And>
        </Filter>
        <Status>Enabled</Status>
    </Rule>
    <Rule>
        <Expiration>
            <Days>1</Days>
        </Expiration>
        <ID>object_lifecycle_rule_bucket_6807766</ID>
        <Filter>
            <Prefix>1</Prefix>
        </Filter>
        <Status>Enabled</Status>
    </Rule>
</LifecycleConfiguration>

Deleting Lifecycle Settings

The lifecycle settings for a bucket can be deleted with the "delete-bucket-lifecycle" command. For example:

$ aws s3api delete-bucket-lifecycle --bucket 1-1-1-1 --endpoint-url https://s3.wasabisys.com

Here is another example:

DELETE http://wasabisys.com/1-1-1-1?lifecycle

There is no response body for this call.