How do I fix "Unable to delete object" errors with Object Storage?
I'm trying to delete an object from my Object Storage bucket, and I'm receiving the following error:
Unable to delete object
How do I delete the object?
Those versioned objects can be a pain to find sometimes. Good news is, it's possible to create and delete lifecycle policies to automatically files after a set period of time. If you love the command line, you can do this with s3cmd. Otherwise Cyberduck also allows you to do this.
For s3cmd, you'll need to create an XML file; this example would delete all objects in the bucket after one day:
<LifecycleConfiguration> <Rule> <ID>delete-all-objects</ID> <Prefix></Prefix> <Status>Enabled</Status> <Expiration> <Days>1</Days> </Expiration> </Rule> </LifecycleConfiguration>
Then you can upload the lifecycle policy to your bucket with the following command:
s3cmd setlifecycle lifecycle_policy.xml s3://lifecycle-policy-example
For Cyberduck, there's an option in the S3 bucket settings of the bucket you want to enforce this on.
Lifecycles will make your life so much easier if you're hunting for old files all the time. Good luck!