Categories
General

Erlang and Amazon’s S3 Storage Service

Hurrah, Erlang OTP R12B-0 has been released! The new version includes my fix to the http client. This is good news because it means that my erlang bindings for Amazon’s S3 storage service are now usable without having to patch OTP. Check out the retro distribution page for s3erl. Instructions in the README.

At the moment, the s3 library allow you to
– create, list and delete buckets
– read, list, delete and write objects

Things which I’d like to add if I get the time
– Improved error handling
– Support for EU-based S3 buckets. (not too hard)
– Support for streaming objects to/from disk (inets supports streaming to disk, but not from disk just now) (harder)

UPDATE:  You can now get the source from the public mercurial repository; “hg clone http://hg.nobugs.org/s3erl”.

5 replies on “Erlang and Amazon’s S3 Storage Service”

Tried it and I got this error:

1> s3test:run( “XXXXXXXXXXXXX”, “YYYYYYYYYYYYYYY”, “test.sungnyemun.com”).
Exercising s3erl on bucket “test.sungnyemun.com”

=ERROR REPORT==== 29-Dec-2007::13:36:07 ===
** Generic server s3 terminating
** Last message in was {listbuckets}
** When Server state == {aws_credentials,”XXXXXXXXXXXXX”,
“YYYYYYYYYYYYYYY”}
** Reason for termination ==
** {bad_return_value,{s3error,”RequestTimeTooSkewed”,
“The difference between the request time and the current time is too large.”}}
** exception exit: {bad_return_value,{s3error,”RequestTimeTooSkewed”,
“The difference between the request time and the current time is too large.”}}
2>

Could it be that the time values are based on US time? I am in HK, GMT+8, so this could be a problem…?

I tried your s3erl library, but running s3test:run/3 errors on creating bucket – message says it’s wrong credentials like this:

=ERROR REPORT==== 2-Feb-2008::15:18:38 ===
** Generic server s3 terminating
** Last message in was {put,”KS-test-bucket”}
** When Server state == {aws_ident,”XXXX”, “XXXX”}
* Reason for termination ==
** {bad_return_value,{s3error,”SignatureDoesNotMatch”,
“The request signature we calculated does not match the signature you provided. Check your key and signing method.”}}
** exception exit: {bad_return_value,
{s3error,”SignatureDoesNotMatch”,
“The request signature we calculated does not match the signature you provided. Check your key and signing method.”}}

Since the list_buckets were ok, it’s not the problem of credentials. Do you think that maybe there is some error in your function for making the Authorization header? Is it possible, that the error does not occur on your system because you don’t have any special characters in credentials? Or maybe missing urlencode somewhere…. 🙁

md: S3 has a single namespace for buckets. I suspect someone has already claimed “KS-test-bucket”. If you try again with a different (and unique) bucket name, it should work. I’ll look at improving the test code to check for this eventuality.

Comments are closed.