Report this

What is the reason for this report?

Spaces Lifecycle is not expiring files

Posted on October 12, 2018
Luke

By Luke

I am trying to setup a lifecycle rule to delete all files older than 5 days. I can successfully PUT the lifecycle and confirmed it is up there with a GET. However, it doesn’t look like any files are getting removed.

Below is the rules.json file:

{ “Rules”: [ { “ID”: “Remove old files”, “Status”: “Enabled”, “Prefix”: “”, “Expiration”: { “Days”: 5 } } ] }

And here is the AWS command I used:

aws s3api --endpoint-url=https://nyc3.digitaloceanspaces.com
put-bucket-lifecycle-configuration
–bucket REDACTED
–lifecycle-configuration
file://rules.json

Am I missing something obvious?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Did you get it working? API returns all the rules I’ve set (see below) but files are not being deleted even after 11 days and trash just keeps piling. Not cool…

{
    "Rules": [
        {
            "Status": "Enabled", 
            "Prefix": "/", 
            "Expiration": {
                "Days": 2
            }, 
            "ID": "Remove old tmp files"
        }, 
        {
            "Status": "Enabled", 
            "Prefix": "", 
            "ID": "Remove uncompleted uploads", 
            "AbortIncompleteMultipartUpload": {
                "DaysAfterInitiation": 1
            }
        }
    ]
}

I get the same issue. The lifecycle policy is not deleting the files. Setting a prefix or keeping it empty does not make a difference.

There might be an issue with overlapping rules. Try creating a single rule with 2 actions (expire + abort incomplete):

{
    "Rules": [
        {
            "ID": "Remove old backups",
            "Status": "Enabled",
            "Prefix": "/",
            "Expiration": {
                "Days": 2
            },
            "AbortIncompleteMultipartUpload": {
                "DaysAfterInitiation": 1
            }
        }
    ]
}

(I’m not sure whether the prefix should be “/” or “” (empty string), though. Might help to try with both.)

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.