Using Amazon S3 for web file storage
5 Comments Published September 30th, 2009 in Open Source, Web 2.0, Web design, Wordpress, amazon, plugins, themes.Lately I’ve been looking around some solutions what could reduce the load and connections to my server and I found out, one interesting service from Amazon, Amazon Simple Storage Service (Amazon S3). This service allow you to store your web files into cloud storage in amazon infrastructure, and can retrieve it from anywhere through a custom link.
First thing first, you have to have an account with Amazon S3. You need to fill in a valid payment options, in my case, I have to put it my credit card number for payment purposes. Talking about payment, let check Amazon S3 service rate. This is quoted from Amazon S3 page. The price is quite low, if you’re putting small web related files. It will be charged according to how many data been transfered from Amazon S3.
For United States
Storage
- $0.150 per GB – first 50 TB / month of storage used
- $0.140 per GB – next 50 TB / month of storage used
- $0.130 per GB – next 400 TB /month of storage used
- $0.120 per GB – storage used / month over 500 TB
Data Transfer
- $0.100 per GB – all data transfer in
- $0.170 per GB – first 10 TB / month data transfer out
- $0.130 per GB – next 40 TB / month data transfer out
- $0.110 per GB – next 100 TB / month data transfer out
- $0.100 per GB – data transfer out / month over 150 TB
Requests
- $0.01 per 1,000 PUT, COPY, POST, or LIST requests
- $0.01 per 10,000 GET and all other requests
*
* No charge for delete requests
For Europe
Storage
- $0.180 per GB – first 50 TB / month of storage used
- $0.170 per GB – next 50 TB / month of storage used
- $0.160 per GB – next 400 TB / month of storage used
- $0.150 per GB – storage used / month over 500 TB
Data Transfer
- $0.100 per GB – all data transfer in
- $0.170 per GB – first 10 TB / month data transfer out
- $0.130 per GB – next 40 TB / month data transfer out
- $0.110 per GB – next 100 TB / month data transfer out
- $0.100 per GB – data transfer out / month over 150 TB
Requests
- $0.012 per 1,000 PUT, COPY, POST, or LIST requests
- $0.012 per 10,000 GET and all other requests
*
* No charge for delete requests
Once you have your account created and ready, go to http://aws.amazon.com, go to “Your Account” and “Security Credentials”. Look for “Access Keys”. This key is like a password to your storage. So, don’t reveal it to anyone!!
To start, you have to have a client to access Amazon S3. You can either code your own code to access it through programming API, or use ready coded application. Of course the later is faster
For me, I use CloudBerry S3. It is a Amazon S3 explorer. You can manage your file, alot like you’re using FileZilla to manage your file with FTP account. There is a free version, and the free version works like charm for me, i don’t need the paid version.
The those keys, and put it in your CloudBerry. As shown below.
To start using Amazon S3, you need some sort like address, a unique identifier that will be part of the URL you going to use to access your files on Amazon S3. They call it bucket. You have to create your bucket, and you can create as many as you want, as long as it is unique within Amazon S3 system. In my case I have created “images.nettipsdb“, so it becomes accessible through http://images.nettipsdb.s3.amazonaws.com/. If I put an image file, named myphoto.jpg in my buckets root location, it will become accessible though http://images.nettipsdb.s3.amazonaws.com/myphoto.jpg.
I have placed some static files, like images and javascript files onto Amazon S3, as Amazon S3 doesn’t do any processing, it is just a simple storage service, and the service name tells. I noticed in my apache log, there’s a lot of files been requested to the web server to load up the images and other files. I have placed a mod_evasive, an apache module that limit connection made to apache to avoid Denial Of Service (DOS) Attack. I’m afraid some of my users won’t be able to retrieve some files because of this. This is one purpose of having Amazon S3 to help my site. There are some others tricks that might help, such as CSS sprite and PHP speedy wordpress plugin, but I have some problem to implement this on my site.
What I did, I did some hard coded modifications on my themes, and some plugins that loads up some javascripts. For example, in my themes header.php file, I replaced
with
Therefore, it will load the javascript file straight away from Amazon S3. Now, I can see the difference in the request made to my web server, a lot less. But make sure, you have a backup of all your files, your modified files, and also the whole bucket, in case u need them. Right now, your hosting and Amazon S3 run side by side. If your files in Amazon S3 accidently deleted, your site will not work.
The best waty is still to combine images into 1 image file with CSS sprite or combining javascript. But I have problem with some wordpress plugin for that purpose. Will into it soon.
Related posts



If you are having problem with time, if Amazon reply with wrong time setting, I solve my problem by updating my time using NIST time server, check out the IP list at http://tf.nist.gov/service/pdf/win2000xp.pdf. This is the site, http://tf.nist.gov/service/its.htm
Thanks so much for mentioning CloudBerry Explorer in your blog! Please contact us to claim your free PRO license.
Thansk
Andy
CloudBerry Lab team
Wow, I’m entitled to get a free PRO license? cool! I never know such deal. Thanks alot!
Hello everybody! I do not know where to start but hope this site will be useful for me.
I will be glad to get some assistance at the beginning.
Thanks in advance and good luck!
Hey, just saying hi!