For online audio distributors: Host your audio on S3 with statistics!

Standard

Image by samwebster (CC,http://www.flickr.com/photos/samwebster/4378872439/)

A quick guide for those distributing large amounts of audio on the Internet: As you know, audio services are great but are also costly. Consider hosting the files yourself on Amazon S3 and potentially save a lot of money. In my case I have sliced next year’s cost by at least 30%. It’s a little bit of a geeky guide but I managed to go through the installation steps myself within one hour. Ofcourse you can leave your thoughts or ask questions in the comment section.

Let’s make it a hypothetical case: I am hosting a podcast called joopspodcast.com – which is entirely about myself LOL. Amazingly I have about 50k downloads a year. We will compare a well known audio hosting service which shall remain unnamed; let’s call it AudioHoster INC. for now, with amazon S3. We compare with S3 because I build some experience with the service and it’s my gut feeling it’s cheaper then hosting it on AudioHoster INC’s servers.

Comparing the two options:

Advantages of using AudioHoster INC.

  1. They take care of your offsite backups (If they are professional service)
  2. Statistics about the users behaviour
  3. Cool flash players for users to play the files with

Advantages of self hosting on S3

  1. Amazon S3 is likely to be cheaper to host
  2. Cost based on actual MB’s served
  3. Able to cancel contract at any time

Thinking about it, I am sure we can offer all 3 advantages of the AudioHoster INC. on our self hosted environment. More about that after the following cost calculation:

Worth the trouble? – cost calulation

Comparing potential cost of both services.

Whilst hosting audio with AudioHoster INC. is great, but I paid €29 a year for a ‘lite’ account which provided me with 4 hours of audio hosting. This was fine at first but within a year we had to move to a premium account – even though this particular audio hosting service was kind enough to sponsor me with a trial of their premium. Premium will be around €79 per year for 12 hours.

Comparing the prices is hard. After all, we suddenly need to pay for the amount of users that download our content per megabyte. All kinds of variables come in to play like the amount of visitors and the amount of data they copy. The only thing one can do is underline that this is a loose calculation on a sunday afternoon and is based on a hypothetical case. But enough data to base our decision on:

Calculating hosting costs for Amazon S3 goes as follows: (cost for total GB hosted + puts = costs). On average, a minute of MP3 (128kbps) is 0.91MB. Amazon charges $0.01 per 10,000 GET and all other requests. In the case we will host 4 hours (240 min) of audio.

Case 1: 4 hours

We have about 4 hours of audio data with about 50.000 downloads a year:

Total GB of audio: (240 minutes * 0.91 average MB for minute of mp3) = 218MB (0.212 GB)
Hosting costs: 0.218 Total GB of audio * $0.093 price per GB = $0.02 * 12 months = 0.06
Average audio time: 5 min = 4.55 mb. Serving that to 50k people equals 244GB.

Data transfer costs: 243 (estimated MB – free first GB) * 0.120 (from here) = $29.16
Puts: 50000 * ($0.01/10000) = $0.05 * 12 =

Total cost per year: 0.06 (Hosting costs) + 29.16 (Data transfer costs) + 0.6 puts = $29.82

Case 1: 12 hours

We have about 12 hours of audio data with about 100.000 downloads a year.

Total GB of audio: (720 minutes * 0.91 average MB for minute of mp3) = 655MB (0.639 GB)
Hosting costs: 0.639 Total GB of audio * $0.093 price per GB = $0.06 * 12 months = 0.72
Average audio time: 5 min = 4.55 mb. Serving that to 100k people equals 444GB.

Data transfer costs: 443 (estimated MB – free first GB) * 0.120 (from here) = $53.16
Puts: 100000 * ($0.01/10000) = $0.1 * 12 = 1.2

Total cost per year: 0.72 (Hosting costs) + $53.16 (Data transfer costs) + 1.2 (puts) = $65.99

Summing up

As said, AudioHoster INC. charges:
4 hours for €29
12 hours for €79

Hosting on S3
4 hours for €21*
12 hours for €45*
*converted on 21/08/2011 dollar to euro exchange rate

making hosting 4 hours about 74% of AudioHoster INC’s price, 12 hours about 56% of the price.

It seems to me, as benefits are marginal on 4 hours but at 12 hours become worth while. Guess our trouble become valid after about that time. SInce I passed 4 hours i’m gonna say: screw AudioHoster INC. for now and we will set it up ourselves on S3.

How to do this?

Before we start, make sure to check at least the following isn’t a problem for you:

  1. Credit card for subscribing to S3
  2. basic knowledge about Linux
  3. For statistics, we need install rights on a (linux) webserver. In my case I used an ubuntu server, the one that hosts joopspodcast.

So, we setup S3 but we don’t stop there. We want to install the domain’s DNS for better URLS, and add statistics to keep a close eye on potential costs and visitor data. We then covered most of the advantages of using a subscription service. Perhaps some other day I will add how to add cool web players.

For joopspodcast.com, I want to host the files in a subdomain called media.joopspodcast.com, not in amazon’s created URL’s. Why? Two reasons: People linking to your files link to your domain, which equals increased pagerank. Secondly, the amazon URL’s are super long and hard to remember!

Setting up Amazon S3

  1. Navigate to https://console.aws.amazon.com/s3/home?
  2. Sign up/login to the S3 service
  3. Create a so called ‘bucket’ – you NEED give it your full intended URL in my case: ‘media.joopspodcast.com’
  4. Copy your podcast files onto your bucket. You can use the online version but I used transmit (mac).

Setting up DNS

  1. Navigate to your domains DNS panel.
  2. Add a CNAME. In my case: Recordname ‘media’ value “http://media.joopspodcast.com.s3.amazonaws.com.)
    (don’t forget the dot at the end and if you are an European user, use s3-external-3.amazonaws.com. instead)

Now everything in the bucket http://media.joopspodcast.com.s3.amazonaws.com can be addressed with your new shortURL media.joopspodcast.com.

Setting up analytics

  1. Go to your webserver and install AWStats I also installed freegeoIP tools to track where people came from (guide)
  2. Install Johan Steen’s get-aws-logs.py script (link)
  3. Configure according to Johan Steen’s recommendations (link)
  4. Some pointers that got me further were:
    S3 AWStats LogFormat
    LogFile="/var/log/apache2/media.joopspodcast.com.log"
    LogFormat="%other %extra1 %time1 %host %logname %other %method %url %otherquot %code %extra2 %bytesd %other %extra3 %extra4 %refererquot %uaquot %other"

Offsite backup

Will happen on my own terms. Usually before I upload audio files I will make a backup and save it within my document backup environment. Offsite backup arranged!

Credits:

Thanks to Carlton with help setting up S3 DNS: http://carltonbale.com/how-to-alias-a-domain-name-or-sub-domain-to-amazon-s3
Johan with help getting analytics logs imported: http://wpstorm.net/2010/11/aws-s3-logs-boto-python/ http://wpstorm.net/2011/01/awstats-amazon-s3-cloudfront/

Leave a Reply