views:

577

answers:

2

I am migrating my Java,Tomcat, Mysql server to AWS EC2.

I have already attached EBS volume for storing MySql data. In my web application people may upload images. So I should persist them. There are 2 alternatives in my mind:

  1. Save uploaded images to EBS volume.
  2. Use the S3 service.

The followings are my notes, please be skeptic about them, as my expertise is not on servers, but software development.

  • EBS plus: S3 storage is more expensive. (0.15 $/Gb > 0.1$/Gb)

  • S3 plus: Serving statics from EBS may influence my web server's performance negatively. Is this true? Does Serving images affect server performance notably? For S3 my server will not be responsible for serving statics.

  • S3 plus: Serving statics from EBS may result I/O cost, probably it will be minor.

  • EBS plus: People say EBS is faster.

  • S3 plus: People say S3 is more safe for persistence.

  • EBS plus: No need to learn API, it is straight forward to save the images to EBS volume.

Namely I can not decide, will be happy if you guide.

Thanks

+2  A: 

You already outlined the advantages and disadvantages of both.

If you are planning to store terabytes of images, with storage requirements increasing day after day, S3 will probably be your best bet as it is built especially for these kinds of situations. You get unlimited storage space, without having to worry about sharding your data over many EBS volumes.

The recurrent cost of S3 is that it comes 50% more expensive than EBS. You will also have to learn the API and implement it in your application, but that is a one-off expense which I think you should be able to absorb very quickly.

Daniel Vassallo
Yes learning api is not problem. What I want to clarify is whether serving statics outside the server (namely, letting S3 serves them) will have positive impact on my RAM usage?? I predict the memory (RAM) will be bottleneck for my server.
javanes
Yes. Serving from S3 will free your EC2 instance from this responsibility, so it will absolutely save some CPU and RAM resources. How much depends on the traffic you expect. You may be interested in checking out the following Coding Horror blog post on this topic: http://www.codinghorror.com/blog/2007/03/using-amazon-s3-as-an-image-hosting-service.html
Daniel Vassallo
+5  A: 

I'm currently using S3 for a project and it's working extremely well.

EBS means you need to manage a volume + machines to attach it to. You need to add space as it's filling up and perform backups (not saying you shouldn't back up your S3 data, just that it's not as critical).

It also makes it harder to scale: when you want to add additional machines, you either need to pull off the images to a separate machine or clone the images across all. This also means you're adding a bottleneck: you'll have to manage your own upload process that will either upload to all machines or have a single machine managing it.

I recommend S3: it's set and forget. Any number of machines can be performing uploads in parallel and you don't really need to notify other machines about the upload.

In addition, you can use Amazon Cloudfront as a cheap CDN in front of the images instead of directly downloading from S3.

Gary Richardson
+1 for S3+Cloudfront. I'm using it for serving Flash movies for one of our properties and it works very well.
devstuff