Tying Perl hashes to Amazon S3 buckets

December 16th, 2007
//-->

As mentioned last time, I released my first Perl module to the CPAN, called Tie::Amazon::S3. What it does is rather simple: it allows one to treat an Amazon S3 bucket as a Perl hash, like so:


use Tie::Amazon::S3;
tie my %bucket, 'Tie::Amazon::S3', $my_aws_id, $my_aws_passwd, $my_s3_bucket;
 
# read a remote file to a scalar
my $textfile = $bucket{textfile};
 
# write some text to a key
$bucket{'songs/freesoftwaresong/list'} = <<EOF;
freesoftwaresong.au
jonobacon-freesoftwaresong.ogg
Fenster-FreeSoftwareSong.ogg
EOF

Tie::Amazon::S3 builds on top of Leon Brocard’s Net::Amazon::S3 module, so one can still do other actions such as setting a key’s ACL by accessing the tied(%bucket).

Today I made another version of that module, completing the hash abstraction by implementing some missing methods, allowing one to iterate through the list of available keys in the bucket (e.g. foreach keys %bucket and such.)

As mentioned, it can be found on the CPAN, but I also have a git tree up. Helpful comments & patches are welcome!


One Response to “Tying Perl hashes to Amazon S3 buckets”

  1. Charles Ochava Says:

    Hi Zak,

    My name is Charles and I work for Signium Wardhowell, an executive search. I come across your linked in account and I learned that you are specializing in Perl. This may be informal but I would like to ask if you are interested for an opportunity in Singapore. Our client, which is a mutinational financial institution is currently looking for PERL Developers. This is for a permanent position and they offer good compensation package.

    If you are intersted, you can send your CV at cochava@wardhowell.com.ph or you can call reach me at 09279162911.

    It would be better if we can talk about this opportunity over the phone. Can I get your contact details if possible?

    Thanks a lot.

    I am hoping for a favorable response from you.

    Regards,
    Charles

Leave a Reply