November 17th, 2006

Access Amazon S3 from CL

Sven Van C10e just released CL-S3, "a Common Lisp library to interface with the Amazon S3 Web service". Here's his announcement:

Today I published CL-S3, a Common Lisp library that implements a client interface to the Amazon S3 Web Service (see http://aws.amazon.com/s3 for more information).

More specifically, CL-S3 ( http://homepage.mac.com/svc/cl-s3 )

  • uses the Amazon S3 REST interface
  • does proper authorization
  • implements all S3 API calls with all options
  • parses the XML returned by some of the API
  • converts S3 error responses to proper Common Lisp condition objects
  • allows custom meta header (including canned access policies) and query parameters
  • does proper keep-alive processing (courtesy s-http-client)
  • is portable over Common Lisp implementations (courtesy s-sysdeps)
  • can optionally validate get and put object calls using MD5 hashing
  • contains 2 example higher level functions converting XML to simpler data
  • is properly packaged and has a documented public API
  • should be installed using ASDF
  • is less than 300 lines of code, comments included [but see below -zach]

You can download the code using the URL
   http://homepage.mac.com/svc/cl-s3/cl-s3.tgz
or from S3 itself using the URL
   http://s3.amazonaws.com:80/be-wolf359-test/cl-s3.tgz

CL-S3 is available under an LLGPL license.
The current release is available as a tarball only.

Enjoy,

Sven

"Less than 300 lines" is a little misleading. Here's the :depends-on part of cl-s3.asd:

  :depends-on (:s-http-client 
               :s-xml
               :kpax ;; this is actually overkill, but we need the crypto code and some utilities
               :s-base64))

On the other hand, it's nice that something useful like CL-S3 can be written concisely by accumulating functionality from existing libraries.