Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to limit the number of versions stashed by Amazon S3's versioning?

I'm currently working on migrating the file backup system for my office to Amazon S3. The basic backup is working like a charm but I'm looking to make it a little more robust. Specifically I am looking to add version control for the files in the bucket (using Amazon "Versioning") but there is no mention (that I can find) of a way to limit the number of old versions stashed per file (ie: "File x" has a maximum of 5 previous versions at any given time).

Is it possible to place limits on the number of versions stored per file? Or am I stuck with an unlimited propagation of file versions over time if I go this route?

I've been digging through the AWS forums (as well as anywhere else I look) and have yet to find anything. Any info would be greatly appreciated. Thanks!

like image 251
user3606089 Avatar asked May 05 '14 23:05

user3606089


People also ask

How many versions can an object have when object versioning is enabled?

The examples in this section show how to retrieve an object listing from a versioning-enabled bucket. Each request returns up to 1,000 versions, unless you specify a lower number. If the bucket contains more versions than this limit, you send a series of requests to retrieve the list of all versions.

Can we disable versioning on a version enabled bucket in Amazon S3?

To enable or disable versioning on an S3 bucketSign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/ . In the Buckets list, choose the name of the bucket that you want to enable versioning for. Choose Properties. Under Bucket Versioning, choose Edit.

Can S3 store multiple versions of same file?

You can use S3 Versioning to keep multiple versions of an object in one bucket and enable you to restore objects that are accidentally deleted or overwritten.


1 Answers

While I don't believe Amazon added the option to limit the versions to a specific count of revisions (say "5" previous revisions), you can certainly use S3 lifecycle management, which does support rules based on time. You can use NoncurrentVersionTransition to transition the old version to a different storage class, and you can use NoncurrentVersionExpiration to finally delete an old revision.

So if you backup your data at a predefined time interval (say once a week), then if you set your NoncurrentVersionExpiration to 6 weeks, you'll only keep the last 5 (maybe 6?) versions.

Reference: AWS S3 Lifecycle

like image 185
Bernie Habermeier Avatar answered Sep 21 '22 13:09

Bernie Habermeier