Project

s3_cleaner

0.0
No commit activity in last 3 years
No release in over 3 years
Keeps n releases in S3
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.10
~> 10.0
>= 0

Runtime

 Project Readme

S3Cleaner

The s3_cleaner gem can be used to keep n directories in a S3 bucket/folder (or whatever Amazon calls folders). If the AWS folder contains 20 folders (with timestamp folder names) and the num_releases variable is set to 15, then s3_cleaner will delete the 5 oldest folders when the delete_old_releases method is run. Here's some example code:

args = {
  bucket_name: "bucket-name",
  prefix: "prefix",
  num_releases: 15,
  aws_config: {
    access_key_id: "aws_access_key_id",
    secret_access_key: "aws_secret_access_key"
  }
}

s3_cleaner = S3Cleaner::Clean.new(s3_cleaner_args)
s3_cleaner.delete_old_releases

Installation

Add this line to your application's Gemfile:

gem 's3_cleaner'

And then execute:

$ bundle

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/MrPowers/s3_cleaner.

License

The gem is available as open source under the terms of the MIT License.