Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does enabling S3 versioning affect the existing files

This is a bit of a silly question - I have an S3 bucket that contains some important production data.

I'm looking to back this data up. S3 versioning seems to be a very good way.

One concern I have is that enabling S3 versioning could affect the existing files. Is it safe to enable versioning before I backup the files offsite?

like image 456
nazbot Avatar asked Oct 21 '16 18:10

nazbot


People also ask

What happens to existing S3 objects when you enable versioning?

When you enable S3 Versioning on an existing bucket, objects that are already stored in the bucket are unchanged. Their version IDs ( null ), contents, and permissions remain the same.

Does S3 lifecycle apply to existing objects?

Lifecycle policies apply to both existing and new S3 objects, ensuring that you can optimize storage and maximize cost savings for all current data and any new data placed in S3 without time-consuming manual data review and migration.

What happens when you delete a file in a bucket that has versioning-enabled?

When versioning is enabled, a simple DELETE cannot permanently delete an object. Instead, Amazon S3 inserts a delete marker in the bucket, and that marker becomes the current version of the object with a new ID.

Which of the following is the best reason to enable S3 bucket versioning?

Versioning-enabled buckets can help you recover objects from accidental deletion or overwrite. For example, if you delete an object, Amazon S3 inserts a delete marker instead of removing the object permanently.


2 Answers

This depends on what you mean by "back up".

Objects stored in Amazon S3 are automatically replicated between multiple data centres within the region. So, AWS is automatically taking care of backups for you.

However, if you are worried about accidentally deleting or overwriting an object, then using Versioning is a good idea. It will allow you to retrieve versions of the objects that have been deleted or overwritten. (Note: You'll pay the full storage cost of old versions as well as current versions.)

Activating versioning does not impact existing objects. Once versioning is activated, it will automatically apply to all objects in the bucket so deleting or overwriting previously-existing objects will function the same as new objects.

Another form of backup you might consider is Cross-Region Replication. This tells S3 to replicate objects from one bucket to a bucket in a different region. The replica bucket can even belong to another AWS account. This has the benefit of keeping objects safe even if somebody intentionally deletes them.

Imagine a scenario with a Systems Administrator who has delete permissions in S3. If they become upset with management and decide to delete all their data, there would be another copy of that data in the replica bucket. This bucket could belong to a different account where the System Administrator does not have permissions to delete data. The downside is that you pay for both copies of the data. The upside is that your data is safe and your company can continue to operate.

like image 140
John Rotenstein Avatar answered Sep 22 '22 15:09

John Rotenstein


It is safe to enable versioning on a bucket with existing objects. The existing objects are not affected.

like image 36
Michael - sqlbot Avatar answered Sep 24 '22 15:09

Michael - sqlbot