Posted almost 11 years ago. Visible to the public. Linked content.
Enable Versioning on Amazon S3 bucket using ruby
If you want to enable versioning support for an Amazon S3 bucket, you can use the fog gem.
Copy$ gem install fog $ irb irb> require 'fog' irb> storage = Fog::Storage.new({:provider => 'AWS', :aws_access_key_id => ACCESS_KEY_ID, :aws_secret_access_key => SECRET_ACCESS_KEY}) irb> storage.put_bucket_versioning("your bucket name", "Enabled")
To find out the status of your bucket versioning (can be NIL, if versioning was never used on the bucket, "Enabled" if versioning is currently used, and "Suspended" if versioning was used on that bucket once but is disabled currently).
Copyirb> storage.get_bucket_versioning("your bucket name")