Politics, Programming and Possibilities
23 Oct
We (at FamilyLearn) have been using Amazon S3 for photo storage in our new system. The Ruby libraries are still a little young, so we run in to trouble occasionally.
For example, today I was unable to limit the number of keys returned from a bucket with the :max_keys option. As it turns out, the Amazon API expects “max-keys” even though Ruby syntax does not allow dashes in its symbols. This turned out to be a simple problem to fix:
@files = @@s3_connection.list_bucket(
@current_bucket,
:prefix => @prefix,
:"max-keys" => 15).entries
3 Responses for "Amazon S3 "max-keys""
Useful! Thank you.. any other good S3 tips? I’m just about to start integrating it myself.
Duane, you might consider using my S3 Ruby library, rather than the sample provided by Amazon. I’ve considerably expanded the capabilities of their sample and added lots of new stuff, e.g. object wrappers for the responses, faster parsing using libxml, access logging, support for ACLs. Plus I’ve put in a fair amount of error checking and comments which hopefully help the REST interface make more sense. I’m always looking for new contributions and feedback about usability. You can find it at http://rubyforge.org/projects/s33r/.
Brian: I’ll post more tips as they come. I’m glad to know this one was useful for you.
Elliot: Thanks for reminding me of s33r. I did check it out at one point, but I think the project was also in its early development stage. It appears you’ve improved it since
Leave a reply