S3Cmd is a minimal wrapper around the s3cmd command line interface created for the sole purpose of being able to track upload progress to S3 from ruby.
The gem comes packaged with a very slightly modified version of s3cmd so no need to install it on the system.
(sudo) gem install s3cmd
Require the gem
Unless you are using bundler of course.
require 'rubygems' require 's3cmd'
First you'll want to configure S3Cmd with your aws credentials.
S3Cmd.configure do |config| config.access_key = "your_access_key" config.secret_key = "your_secret_key" config.use_https = true or false end
Time to get down to business.
S3Cmd.put("path/to/a/file.ext", "s3://name-of-a-bucket/path/to/destination.ext") do |progress| puts progress # 0.0 .. 1.0 end