Jeff
Jeff

Reputation: 7210

Does S3 copy keep versioning

According to amazon

Versioning allows you to preserve, retrieve, and restore every version of every object in an Amazon S3 bucket. Once you enable Versioning for a bucket, Amazon S3 preserves existing objects anytime you perform a PUT, POST, COPY, or DELETE operation on them.

Am I correct in assuming that if I copy the content from one bucket in region x to another bucket in region y that the version history will be preserved?

If versioning is not kept through a copy request, how would I be able to transfer the versioning over to the new bucket? I would like to use boto for this but will accept any language.

Thanks

Upvotes: 5

Views: 2954

Answers (1)

Michel Feldheim
Michel Feldheim

Reputation: 18250

Unfortunately: no

The version history is saved for each file within a bucket which has versioning enabled. If you modify the file it will preserve the old version and create a new revision for your current version.

If you copy a file to another bucket, even within the same region, the target file will be revision 1.

I've tested this using Cloudberry S3 Explorer Pro

EDIT:

You can actually access each version of the file directly. So what you could do is to copy version by version, replaying the whole process on the new bucket. This will indirectly copy the file including versioning

Upvotes: 7

Related Questions