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.

$ gem install fog $ irb irb> require 'fog' irb> storage ={: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).

irb> storage.get_bucket_versioning("your bucket name")

Owner of this card:

Matthias Marschall
Last edit:
almost 11 years ago
Posted by Matthias Marschall to Matthias Marschall
This website uses short-lived cookies to improve usability.
Accept or learn more