Cliaws: command-line access to S3
2008-04-15
I just released a new gem on RubyForge: cliaws. Using it, you have access to nice command line shortcuts:
1 $ AWS_ACCESS_KEY_ID=<your access key> 2 $ AWS_SECRET_ACCESS_KEY="<the secret access key>" 3 $ clis3 list BUCKET/PATH-PREFIX 4 $ clis3 put BUCKET/FULL/PATH/NAME /path/to/local/file 5 $ clis3 get BUCKET/FULL/PATH/NAME /path/to/local/file 6 $ 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 require "rubygems" 2 require "cliaws" 3 4 # Retrieve and store in a variable 5 value = Cliaws.s3.get("BUCKET/FULL/PATH/NAME") 6 7 # Retrieve and stream to specified file 8 File.open("/path/to/local/file", "w") do |f| 9 Cliaws.s3.get("BUCKET/FULL/PATH/NAME", f) 10 end 11 12 # Returns an Array of full names 13 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 !
blog comments powered by Disqus