Using Amazon S3 as an Image Hosting Service

If image bandwidth becomes a real problem, it might be cheaper to use SneakerNet for hosting. Just print the images out and send them by UPS to your readers.

@ R.I.Pienaar

Yeah and Dreamhost will suspend your account with no warning if your site starts to generate some nice traffic. They have mad CPU usage restrictions!

Look into “Virtual Hosting of Buckets” if you decide to stick with S3 for direct static content serving. Makes the urls nicer, more portable, etc.




Did you look into using Akamai at all?

Another S3 tip, although this probably isn’t very important.

You can create a CNAME record off your domain and point it to, creating a branded URL to your S3 bucket. Your bucket name must also match the CNAME + domain name.

So, you could create a CNAME record named “S3” and point it to Then, create a bucket called “” in your S3 account and place all your static stuff there. Then, when you create the reference in your code you can use “”.

I think akamai is built for much larger clients. While I don’t know their pricing plan off the top of my head this research paper shows that amazon is actually one of THEIR customers. I wonder if Amazon isn’t simply buying massive bandwidth from akamai then reselling it to users.

"We focus our efforts on the Akamai CDN, which is perhaps the
most extensive distribution network in the world – claiming over
15,000 servers operating in 69 countries and 1,000 networks [4].
Without Akamai’s CDN, highly popular web enterprises such as
Yahoo, Amazon, or The New York Times would be unable to serve
the gigabytes of data per second required by the images, Flash animations,and videos embedded in their web sites."

I can’t recommend S3 for media hosting enough. I’ve been using it for nearly a year to host all the media files for…
All the xml files the map reads are cached to S3 as well as the swf itself and all the high resolution map data layers.
All the flash/swf files and thumbnail images.

I’ve never had any problems with performance and being based in New Zealand I’ve not noticed any international issues either.

Apart from taking the load off my server at media temple it means I can move websites around in between hosts without having to move gigs of data. I’m just left running the database and skeleton php templates. I did it not so much to save on bandwidth but to get scalability. When Searchbots was bombarded by digg users the server only had to handle the database calls and all the logic was contained in the flash files hosted at S3. The server barley showed any increase in load.

Setting up a cname record to map a subdomin is very easy so you can serve files from your own domain like…

Here’s the easiest php class I’ve found for interacting with S3. Although it is based on other PEAR classes which can be a pain to install sometimes if you don’t have PEAR up and running.

Akamai is VERY expensive. You aren’t worth their time and server space unless you’re paying thousands in bandwidth. I used them under Gannett’s Broadcast division. They have some very cool tools but you do pay for them.

If you like Micropayments, you might also look at NearlyFreeSpeech. It’s a similar model to S3, in that you only pay for bandwidth/space used, but it’s a full web host.

You can’t compare GoDaddy and Dreamhost to something like S3 – they are apples and oranges. For one, you shouldn’t patronize GoDaddy (read:, and two, Dreamhost sucks (they just had what, 36 hours or so of almost complete downtime?). With huge hosts you supposedly have “2.2 TB” of bandwidth, but do you honestly think they can allow customers to get anywhere near that? As soon as you start using resources, you’re less profitable. S3 and NFS and other micro-payment hosts build their profit into each unit used, there is no overselling.

(This coming from a very old DreamHost customer. My site was shifted from server to server because I used a majority of my plan allowance. Each “server move” caused 24+ hours of effective downtime.)

We looked in to Akamai vs Amazon. Amazon turns out to be much cheaper. For the tiny bit of bandwidth and storage this site needs, Amazon might be cool but not the most economical solution. Its gets to be a good value when you have high and low peaks in your bandwidth say 80mb file that you ship every 3-6 months to 300,000 odd users.

Jeff, I would encourage you to dig a little deeper…S3 is having some growing pains because it was designed for occasionally sharing large files, not “often sharing” small files. Ping times can be over a second, sometimes two. Like Aaron said, great for 80 meg files every once in a while, but not for 15k PNGs 100,000 times a day.

Sounds like S3 might not be the best after reading some of those comments.

What other options are there for offloading images?

I’m sorry for spamming your comments, but the notion of uptime concerns triggered me to post this. I’ve been using Pingdom GIGRIB for uptime statistics:

It works really well, is easy to use and best of all: it’s free! (as in beer)
I’d love a bit more features such as shiny graphs and what not, but that’s just gravy really. It’s a great tool to get quick’n’dirty stats about a given site’s uptime.

for the person who said dream host gives them xxx. webhost4life gives me UNLIMITED bandwidth and 1000 megs of space, for $4.95 a month. THAT would work for photos because 1 gig is fine for lots of small photos, and you have unlimited bandwidth. nooo problem.

I’ve been using S3 to host images for a site I just launched As you can see from the image load times, the latency of S3 is not so good. While S3 is fantastic for reliability, I’m looking for alternative solutions which can offer better performance.

Amazon S3 is the way to go for hosting static image content, and I’m about to roll out an implementation later this weekend. We’ll see how it goes!

I was wondering what would happen if someone leeches your hosted image? Is there a way to control who access the image?

S3 still seems to have some problems with speed. When serving greater than 60,000 hits per day, the images load VERY slowly. Except on days where it’s so slow it’s not even loading. We like the idea of s3, but we switched back to hosting our own images on after too many speed issues. Also, about 1 in 100 loads fail randomly.

Expect all your images to be blocked by Websense.

It would be nice to turn off the “dir listing” in S3.

Col. Sanders, eh? sanders.gif

Not sure what you use for screen shots, but I had been using Flickr as an “image hosting” service for a while and wrote a Cropper Plugin to upload the screen shot to flickr and put the URL in the clipboard for easy reference when blogging.

I have recently been using S3 in a project to host media files and like you, have been impressed with the functionality/cost ratio. I am planning on working up a similar plugin for Cropper to send screenshots to a configured Amazon S3 account:

Any tips/feedback/direction on this plugin (or actually development help) would be great.