Steve Hicks Online

An adventure into all things IT

Entries Comments



Amazon S3 REST Wrapper with Added ACL

4 June, 2007 (22:23) | Projects, Useful Resources | By: Steve

One of the projects I have been working on recently, involved adding files to Amazon S3. Programming in ColdFusion, there was no help for me on the Amazon Developers site, and instead I was directed towards the Amazon S3 REST Wrapper by Joe Danziger.

Now this is a great script and did most of what I needed it to do, except control the ACL of the buckets that you can create on your account at Amazon, which was an integral part of my project.

So, carrying on Joe’s great work, I decided to add the control of the bucket ACL to the script, and have modified his code accordingly. You can download the new version of the code by clicking on the link below:

Amazon S3 Rest Wrapper with Added ACL

The only method that has changed is the putBucket method. Where previously it was:

  • putBucket(bucketName) - create a new bucket.

The modified code now takes into account the ACL:

  • putBucket(bucketName, acl) - create a new bucket with the defined ACL.

I have also modified slightly Joe’s example (S3test.cfm) so that it includes a drop down selection box for the ACL:

Example PutBucket ACL

In this example, you have the following options for the ACL:

  • private
  • public-read
  • public-read-write
  • authenticated-read

Hope everyone gets some use from this, and let me know what you think. Major thanks to Joe for the original code.

Comments

Comment from Anthony
Time: June 7, 2007, 7:22 am

I followed the readme and got everything installed, but when I hit the test page I get: An error occured while Searching an XML document.
Prefix must resolve to a namespace:

Has anyone ever seen this before? I’d really like to start using s3

Comment from Anthony
Time: June 7, 2007, 8:52 am

Nevermind got it all fixed, just had to click the approval link that had been sent to my email. Any idea on how to post to and retrieve from “subdirectories”? (http://developer.amazonwebservices.com/connect/message.jspa?messageID=36250#36250)

Comment from Steve
Time: June 7, 2007, 9:27 am

Anthony,
I had a bit of a play trying to create a sub-directory structure, and upload objects within them. Unfortunately, I had to move onto another project at work which is taking up all my time at the moment, but I’ll have a look as soon as I get chance.
Steve

Comment from Al
Time: July 6, 2007, 6:23 pm

Anthony,

I could really use some help here. This was erroring at first. A restart of CF7 fixed that. I guess it didn’t see the files in the Custom Tags dir.

I need help understanding your “methods” in the ReadMe. Are these to be put directly in the formfield? I’ve tried to “createbucket” and Amazon is registering the calls (which I can see from their cost reports), but no buckets are being created.

How are we to apply the “methods” in your readme.doc?

Comment from Al
Time: July 6, 2007, 6:49 pm

Nevermind. I found that you need a [name.name] convention to insert objects.

NEW ISSUE: When I try to build a link using the ‘Get Link’ url, the link I get says it’s not valid. Is there something I’m needing to append to that link to make it work?

Comment from www.malestripperuk.co.uk
Time: January 24, 2008, 9:38 pm

Strip o grams-kissograms- HUNKY MALE STRIPPER BODYBUILDER for your parties HEN NIGHTS-BIRTHDAYS-LADIES NIGHTS-GAY SHOWS ANY PARTY so If you are organizing a party … call 07876471923 OR VISIT www.malestripperuk.co.uk

Write a comment