Today sees a new release of Cliaws. This is a simple library to interact with S3 (and other services) through the command-line. This library is very similar to Amazon’s own ec2-* scripts, except this library is written in Ruby.
Interacting with S3 should be no harder than:
1 $ clis3 put my-local-file my-bucket/my-s3-file
Put many files at once:
1 $ clis3 put my-local-file0 my-local-file1 my-bucket/my-s3-directory/
Put an environment variable:
1 $ clis3 put --data $MY_DATA my-bucket/my-env-value
Put stdin too!
1 $ tar czfv /var/cache/mylvmbackup/backup | clis3 put - my-bucket/my-backup/backup-20080825-000000.tar.gz
All of this functionnality is available from with Ruby too:
1 require "rubygems" 2 require "cliaws" 3 4 Cliaws.s3.put("this is the content", "my-bucket/my-s3-file") 5 File.open("my-local-file", "rb") do |io| 6 Cliaws.s3.put(io, "my-bucket/my-s3-file") 7 end
Give the RubyForge gem servers a couple of hours to refresh themselves, and then enjoy!