Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support s3 bucket versioning #79

Open
lukakiro opened this issue Feb 16, 2023 · 1 comment
Open

Support s3 bucket versioning #79

lukakiro opened this issue Feb 16, 2023 · 1 comment

Comments

@lukakiro
Copy link

lukakiro commented Feb 16, 2023

Hi,

I'm using depot.io.boto3.S3Storage backend with buckets with Versioning disabled.

But on AWS to make an S3 backup, Versioning on bucket must be enabled.

Looking at the source of depot.io.boto3.S3Storage class:

  • the __save_file() method uses the Object.put() boto3 method which return the VersionId of the created file if Versioning is enabled, but put response is ignored;
  • the delete() method uses the Object.delete() boto3 method which deletes only the null version of the Object if exists, so trying to delete a versioned object, nothing will be deleted.

How can I use depot.io.boto3.S3Storage with Versioning enabled?

Thanks

@amol-
Copy link
Owner

amol- commented Feb 16, 2023

DEPOT is designed to keep its own transactional behaviour, so it never rewrites existing files. Any time you edit a file a new file with a different unique id is created. So every file would always only have one single version, making the versioning system pretty useless.

Using S3Storage with S3 versioning enabled shouldn't change much for DEPOT. It's true that when you issue a delete command the underlying file wouldn't be actually deleted. But a deletion market would be saved by S3 and thus from the external point of view the file would behave as it was deleted. It doesn't really get deleted because that's the whole concept of versioning. If you really deleted the file you wouldn't be able to move back to the previous version and thus restore the deleted file.

S3 versioning with DEPOT is mostly useless, but shouldn't impair the correct functioning of DEPOT. You will just end up with tons of historical versions around if you frequently modify depot managed attachments, but that's the whole purpose of versioning.

Also be aware that strictly speaking, S3 Versioning is not a backup mechanism. It wouldn't protect you from a bug or a person accidentally deleting all versions on an object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants