Since Railo 2.0 introduced resources (virtual file systems) and everything file based in Railo is based on these resources, we have implemented a new resource called S3. This resource can be used as any other resource as well. So if you have an accessKeyID and a secretAccessKey, you can use it quite easy like follows:
<cffile action="copy" source="s3://[accessKeyID]:[secretAccessKey]@s3.amazonaws.com/bucketname/susi.txt" destination="c:\susi.txt">Now, if you define a mapping that points to a S3 resource like follows:
MappingName:
/myS3Storage
Resource path
s3://[accessKeyID]:[secretAccessKey]@s3.amazonaws.com/bucketname/
you can use it in your code like this:
<cfinclude template="/myS3Resource/susi.cfm"> <!--- or --->
<cfif fileExists("/myS3Resource/susi.cfm")>
...
</cfif>
<cfdirectory dir="/myS3Resource" action="list" name="s3Files>
<cfdump eval="s3Files">
Please note that if you don't define the bucket name you can list all your buckets by using CFDIRECTORY on it. So for example it is very easy to store your video files you convert with
Updated: December 15th, 2009
Railo's Amazon S3 extension is a paid extension. If you need information about availability / cost, please Contact us.
Updated: December 15th, 2010
The Amazon S3 functionality is now baked into the Railo core and available in the Railo 3.2 release free of charge.
17 responses so far ↓
1 Jeff Gladnick // Mar 31, 2008 at 4:46 AM
2 David Low // Mar 31, 2008 at 11:59 AM
3 jeff // Mar 31, 2008 at 4:57 PM
We have started using S3 for lots of things and this would make dealing with S3 easier.
Although the s3 cfc is really great.
4 Joe Potenza // Mar 31, 2008 at 10:33 PM
Do I need a newer version of Railo, or to install anything additional? I already use the S3 cfc with success, but I'd like to test this method and see which works best for me.
5 Gert Franz // Apr 1, 2008 at 8:04 AM
at the moment we are experimenting with a public amazon ec2 image with Railo/Linux/Apache/MySQL. As soon as we have it ready for playing around, I will write here about it.
At Scotch I will demonstrate how to use the different types of resources, for any of you who want to know how this works.
@Joe
Joe, you need at least the Railo version 2.0.0.038 in order to play with the amazon s3 resource. After having updated to it, (at the moment) you have to manually tell Railo where to find the resource. This can be done in the railo-web.xml.cfm file. Just add the following entry to the <resources> element (as an example below, line 3):
1: <resources><!-- arguments: lock-timeout - define how long a request wait for a log -->
2: <resource-provider arguments="case-sensitive:true;lock-timeout:1000;" class="railo.commons.io.res.type.ram.RamResourceProvider" scheme="ram"/>
3: <resource-provider arguments="lock-timeout:10000;" class="railo.commons.io.res.type.s3.S3ResourceProvider" scheme="s3"/>
4: </resources>
then you can use the Amazon s3 resource like I described. We will officially release the Amazon S3 resource with Railo 2.1.
Let me know how it works.
Gert
6 Brad B. // Apr 1, 2008 at 9:09 AM
7 Streit Michael // Apr 1, 2008 at 9:56 AM
8 Joe Potenza // Apr 1, 2008 at 10:38 AM
Thanks,
Joe
9 Gert Franz // Apr 1, 2008 at 11:48 AM
Gert
10 Mike Kelp // Apr 1, 2008 at 1:14 PM
You guys are really innovating with CF. Awesome work.
Mike.
11 Joe Potenza // Apr 1, 2008 at 10:48 PM
FYI, after updating my railo installation to 2.0.0.043, calls to facebook's API stopped working. I discovered that the problem was the new version seems to UCASE the key names when looping over a structure. Simply putting an LCASE() around the key name when passing it to facebook fixed the problem. Not sure if this will affect anybody else, but it's something to keep in mind.
Joe
12 Andrew Grosset // Jan 5, 2009 at 9:09 PM
Andrew.
13 Andrew Grosset // Jan 12, 2009 at 6:37 AM
<cffile
action = "copy"
source = "C:\mystuff\pics\balloons3d.jpg"
destination = "/myS3Storage/andrew/files/balloons3d.jpg"
acl = "public-read"
>
Andrew.
14 Jeff // Apr 23, 2009 at 6:27 AM
However, I am able to connect with a different freeware utility using the same credentials/
15 Gert Franz // Apr 23, 2009 at 8:47 AM
are you using Railo 3.0 or 3.1? This is an extension now in Railo 3.1. In addition you might need to add a certain JAR file and restart the engine.
Have a look at Mark's latest blog posts: http://www.markdrew.co.uk
Gert
16 Dave Anderson // May 23, 2009 at 6:04 AM
17 Gert Franz // May 29, 2009 at 10:00 AM
The buckets are just like directoriy names appended at the end of the s3resource. Sou your definition can look like this:
s3://[accessKeyID]:[secretAccessKey]@s3.amazonaws.com/[bucketname]
Gert
Leave a Comment