Last active
July 30, 2024 16:10
-
-
Save wesort/7c0fc21f95cb4b37f8399a9b17b89ca6 to your computer and use it in GitHub Desktop.
Example for applying expiration policy on Digitalocean Spaces
This file contains hidden or 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 30 days</ID> | |
<Prefix>backup-</Prefix> | |
<Status>Enabled</Status> | |
<Expiration> | |
<Days>30</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.
I found this helpful: hyperborea.org/tech-tips/s3-expiration
Config:
lifecycle.xml
(at root of repo) text file (see above) and configure one or more<Rule>
element(s)<Prefix>
element tells the rule what to filter by.backup-
files after30
days.<Prefix>assets/backup-</Prefix>
assets/
in this example is a "folder" in the Space.s3cmd setlifecycle lifecycle.xml s3://example-assets-01
example-assets-01
is the bucket's names3cmd getlifecycle s3://example-assets-01