Professional Freelance Web Developer
CodeIgniter Activist, Caffeine Junkie

Elliot Haughin

Amazon S3 – The future of all our storage needs?

2nd February 2008

Since I discovered Amazon’s S3 (Simple Storage Service) I’ve been curious about it.

Firstly, it has a very unusual business model; offering unlimited amounts of storage and bandwidth, charging you for what you use.
Their rates are also suprising low:

United States

Storage
$0.15 per GB-Month of storage used
Data Transfer
$0.10 per GB – all data transfer in

$0.18 per GB – first 10 TB / month data transfer out
$0.16 per GB – next 40 TB / month data transfer out
$0.13 per GB – data transfer out / month over 50 TB

Requests
$0.01 per 1,000 PUT or LIST requests
$0.01 per 10,000 GET and all other requests*
* No charge for delete requests

Europe

Storage
$0.18 per GB-Month of storage used

Data Transfer
$0.10 per GB – all data transfer in

$0.18 per GB – first 10 TB / month data transfer out
$0.16 per GB – next 40 TB / month data transfer out
$0.13 per GB – data transfer out / month over 50 TB

Requests
$0.012 per 1,000 PUT or LIST requests
$0.012 per 10,000 GET and all other requests*
* No charge for delete requests

Data transfer “in” and “out” refers to transfer into and out of Amazon S3. Data transferred between Amazon EC2 and Amazon S3, is free of charge (i.e., $0.00 per GB), except data transferred between Amazon EC2 and Amazon S3-Europe, which will be charged at regular rates.

So, say for example you are hosting 25,000 Files at 35GB of data,
and you push out 2.2TB of bandwidth per month:

IN TO S3
35 X $0.18 (Storage in Europe) = $6.30
(25,000 / 1,000) X $0.012 (PUT Requests) = $0.30
35 X $0.18 (Transfer in to S3) = $3.50

OUT OF S3
2,252.8GB (2.2TB) X $0.18 (Transfer out, Europe) = $405.50
(25,000 / 10,000) X $0.012 (GET Requests) = $0.03

TOTAL = $415.63!

These low prices make the service extremely affordable… And that’s without compromising reliability or speed of the service.
Amazon S3 uses Amazon’s huge array of servers around the world to host your files across many servers in many different locations. If one server goes down, your file is available from somewhere else. And, if that file becomes extremely popular, other servers can distribute the load. The S3 Network can also dynamically copy very popular files to additional servers to cope with temporary load spikes.

This extremely affordable, reliable, intelligent, fast hosting solution is just fantastic.
I’ll be using Amazon S3 to power the new version of FilePanda, a filesharing service.

If anyone’s interested in using S3 to host files please take a look at my CodeIgniter port of neurofuzzy’s class

To set up the library, open it up in your text editor and enter your key and secret key at the top of the library.

// -----------------------------------------
// -----------------------------------------
// your API key ID
var $keyId = "";
// your API Secret Key
var $secretKey = "";
// -----------------------------------------
// -----------------------------------------

Here’s an example of how to use the library:

$contents = file_get_contents($path);
$this->load->library('s3');
$this->s3->putObject($filename $contents, $bucketName, 'private', $file['type']);

Sign up for S3 and give it a go… it really is an excellent service, and I’d recommend giving it a try.

  • Thanks for another great library, Elliot.
  • @Felipe: In a way, you do pay 2x for bandwidth when you initially upload to s3, but never again.

    After uploading, a typical use case is printing HTML that references the s3 URL directly rather than re-downloading and serving it yourself.
  • Dave, in terms of pricing you'll be hard pushed to find a reliable, secure host who can provide a GB of bandwidth for $0.18 which is only £0.09 in the UK
  • Dave Salazar
    It is a great service to provide, but I don't think the prices are that low.
  • And what about transfer in the server where your site is hosted?

    You will pay 2 times when you get a file and plus 2 when you download. Or you give directly a link to S3?
blog comments powered by Disqus

Boring Stuff

Design © copyright Elliot Haughin 2009

Content published here are copyright their respective owners.

You cannot copy content from this site, either in English or translated to another language.

Keep Subscribed

Theres lots of ways for you to keep up with me on the web.

Please Note

Information given out on this blog should only be used as a guideline. I hold no liability for any code I write.

Always consult a professional before acting on this guidance.