views:

2234

answers:

3

I have a webapp (call it myapp.com) that allows users to upload files. The webapp will be deployed on Amazon EC2 instance. I would like to serve these files back out to the webapp consumers via an s3 bucket based domain (i.e. uploads.myapp.com).

When the user uploads the files, I can easily drop them in into a folder called "site_uploads" on the local ec2 instance. However, since my ec2 instance has finite storage, with a lot of uploads, the ec2 file system will fill up quickly.

It would be great if the ec2 instance could mount and s3 bucket as the "site_upload" directory. So that uploads to the EC2 "site_upload" directory automatically end up on uploads.myapp.com (and my webapp can use template tags to make sure the links for this uploaded content is based on that s3 backed domain). This also gives me scalable file serving, as request for files hits s3 and not my ec2 instance. Also, it makes it easy for my webapp to perform scaling/resizing of the images that appear locally in "site_upload" but are actually on s3.

I'm looking at s3fs, but judging from the comments, it doesn't look like a fully baked solution. I'm looking for a non-commercial solution.

FYI, The webapp is written in django, not that that changes the particulars too much.

+2  A: 

For uploads, your users can upload directly to S3, as described here.

This way you won't need to mount S3.

When serving the files, you can also do that from S3 directly by marking the files public, I'd prefer to name the site "files.mydomain.com" or "images.mydomain.com" pointing to s3.

Osama ALASSIRY
i *want* to mount s3, so i can have the webapp perform processing task on the files as if they are local, instead of having to code the steps of transferring files back and froth from s3 to ec2 and vice versa. Example of processing task is icon/thumbnail creation. I underdtand the transfer is still actually happening, but atleast it is abstracted away from my webapp code.
+4  A: 

I'm not using EC2, but I do have my S3 bucket permanently mounted on my Linux server. The way I did it is with Jungledisk. It isn't a non-commercial solution, but it's very inexpensive.

First I setup the jungledisk as normal. Then I make sure fuse is installed. Mostly you just need to create the configuration file with your secret keys and such. Then just add a line to your fstab something like this.

jungledisk /path/to/mount/at fuse noauto,allow_other,config=/path/to/jungledisk/config/file.xml 0 0

Then just mount, and you're good to go.

Apreche
We use JungleDisk as well and it's working great for us. I think the Desktop version, which despite the name would suffice for sghael's requirements, is only $20 or so. An optional Plus subscription provides delta-based transfers and upload resume, for a small monthly fee.Performance is good since JD can use a local cache, but will drop once you exceed the cache. S3 is simply not that fast. Thumbs up for JungleDisk though
Martijn Heemels
+2  A: 

I use s3fs, but there are no readily available distributions. I've got my build here for anyone who wants it easier.

Configuration documentation wasn't available, so I winged it until I got this in my fstab:

s3fs#{{ bucket name }} {{ /path/to/mount/point }} fuse allow_other,accessKeyId={{ key }},secretAccessKey={{ secret key }} 0 0

s3fs

ironfroggy