Created
February 27, 2024 14:33
-
-
Save wesort/7c0fc21f95cb4b37f8399a9b17b89ca6 to your computer and use it in GitHub Desktop.
Example for applying expiration policy on Digitalocean Spaces
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<LifecycleConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> | |
<Rule> | |
<ID>Prune files starting with backup- after 1 days</ID> | |
<Prefix>assets/backup-</Prefix> | |
<Status>Enabled</Status> | |
<Expiration> | |
<Days>1</Days> | |
</Expiration> | |
</Rule> | |
</LifecycleConfiguration> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Digitalocean Spaces is S3-compatible object storage
It is possible to set expiration policies for the stored files that they are deleted automatically based on rules.
The filesystem is not hierarchical, it is "flat". This means that folders within the Space aren't "directories", but rather an extended prefix of the filename.
Config:
lifecycle.xml
text file (see above) and configure one or more<Rule>
element(s)<Prefix>
element tells the rule what to filter by.assets/
in this example is a "folder" in the Space.assets/
folder where the filename starts withbackup-
will be deleted after1
day.s3cmd setlifecycle lifecycle.xml s3://wetest-dev-1
wetest-dev-1
is the bucket's names3cmd getlifecycle s3://wetest-dev-1