Cliaws: command-line access to S3
April 14th, 2008
I just released a new gem on RubyForge: cliaws. Using it, you have access to nice command line shortcuts:
1 2 3 4 5 6 |
$ AWS_ACCESS_KEY_ID=<your access key> $ AWS_SECRET_ACCESS_KEY="<the secret access key>" $ clis3 list BUCKET/PATH-PREFIX $ clis3 put BUCKET/FULL/PATH/NAME /path/to/local/file $ clis3 get BUCKET/FULL/PATH/NAME /path/to/local/file $ clis3 cat BUCKET/FULL/PATH/NAME |
This is not rocket science, but with the kind of work I’m doing at the moment, having quick command-line access to S3 is a boon.
Installation
1 |
$ gem install cliaws |
Direct-code access
1 2 3 4 5 6 7 8 9 10 11 12 13 |
require "rubygems" require "cliaws" # Retrieve and store in a variable value = Cliaws.s3.get("BUCKET/FULL/PATH/NAME") # Retrieve and stream to specified file File.open("/path/to/local/file", "w") do |f| Cliaws.s3.get("BUCKET/FULL/PATH/NAME", f) end # Returns an Array of full names contents = Cliaws.s3.list("BUCKET") |
Repository
The repository is hosted on GitHub, with a mirror on RubyForge.
The repository’s URLs are:Go forth and fork !
April 14th, 2008 at 10:13 PM
That looks like a much saner interface than the one we’re currently using. Thanks!