As my first foray into open-source code, I'm releasing a wrapper for interacting with Amazon's Simple Storage Service (S3) via REST. The wrapper is packaged as a CFC and has the following methods:
A simple test script is included which demonstrates the use of the CFC. You must insert your Amazon S3 access keys in the first 2 lines in s3test.cfm, then just pull it up in a browser.
This is an initial release. Future plans include support for Access Control Lists. If you need something else added, let me know.
This script should run on both ColdFusion MX 6 and 7, let me know if you run into any problems.
The current version is 1.1 and you can visit the project page and download here.
| Sun | Mon | Tue | Wed | Thu | Fri | Sat |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
| 26 | 27 | 28 | 29 | 30 | 31 |
Project Tracker v2.0 Released
Scott said: Joe- Great app - I use it at work. I do have a question, though. I wanted to install this on my host...
[More]
The Importance of HTMLEditFormat()
Andrew said: Just do it when outputting to the screen, not when inserting/updating
data in the database otherwis...
[More]
Project Tracker v2.0 Released
Aaron Bodell said: I came across this app while searching the RIAForge for project trackers. I'm really impressed with ...
[More]
Project Tracker v2.0 Released
Richard said: Thanks Joe - Looking forward to testing the new version!
Is there somewhere we can make suggestions...
[More]
Amazon S3 REST Wrapper
Zac Spitzer said: I've been hacking away on the CFC and I have fixed numerous bugs and added support
for compression, ...
[More]
Thanks again for this amazing script.. i'm stoked at the moment!!
By the way.. you guys did know you can also reach your files thru the following construction... http://bucketnamet.s3.amazonaws.com/name-of-the-fi...
While recently working on a project using Amazon S3, I developed the need to be able to edit the ACL of the buckets I was adding to my S3 account.
Following on from the great work by Joe, I have added ACL compatibility to the putBucket method.
For those of you who are interested, you can download the edited version here - http://www.stevehicksonline.com/2007/06/04/amazon-...
Steve
Prefix must resolve to a namespace:
Has anyone ever seen this before? Id really like to start using s3
As for these "folders", anyone know if you somehow have subfolders within a folder?
@Joe, could you please update the code? You said you fixed it in 1.2, but the only link I can find is to the older version.
<cfset timedAmazonLink = "http://s3.amazonaws.com/#arguments.bucketName#/#ar...(signature)#">
Hope that helps...
Here is the function:
<cffunction name="deleteBucket" access="public" output="false" returntype="string"
description="Deletes a bucket.">
<cfargument name="bucketName" type="string" required="yes">
<cfset var signature = "">
<cfset var dateTimeString = GetHTTPTimeString(Now())>
<!--- Create a canonical string to send based on operation requested --->
<cfset var cs = "DELETE\n\n\n#dateTimeString#\n/#arguments.bucketName#">
<!--- Replace "\n" with "chr(10) to get a correct digest --->
<cfset var fixedData = replace(cs,"\n","#chr(10)#","all")>
<!--- Calculate the hash of the information --->
<cf_hmac hash_function="sha1" data="#fixedData#" key="#variables.secretAccessKey#">
<!--- fix the returned data to be a proper signature
<cfset signature = ToBase64(Hex2Bin("#digest#"))> --->
<cfset signature = URLEncodedFormat(ToBase64(Hex2Bin("#digest#")))>
<!--- delete the bucket via REST --->
<cfhttp method="DELETE" url="http://s3.amazonaws.com/#arguments.bucketName#&quo...; charset="utf-8">
<cfhttpparam type="header" name="Date" value="#dateTimeString#">
<cfhttpparam type="header" name="Authorization" value="AWS #variables.accessKeyId#:#signature#">
</cfhttp>
<cfreturn cfhttp.header>
</cffunction>
Any suggestions welcome,
Andrew.
http://www.coldfusiondeveloper.com.au/go/blog/2008...
and then:
<cfset signature = ToBase64(HMAC_SHA1(variables.secretAccessKey,fixedData)) />
for compression, text uploads, folders, logging, using a proxies (aka fidler2) and a lot of other little things here and there
I also changed the behaviour to return the cfhttp result so it can be properly inspected
for the correct status codes and a dev level response status code checker