Streaming media from Amazon S3

· by Steve · Read in about 2 min · (403 Words)

Thanks John for the reminder to investigate S3 as a business media hosting service, it works like a charm!

Now that I have far fewer bandwidth worries (max $0.17 per GB), the Torus Knot site includes a nifty dynamic selector so you can pick low, medium or high quality - the latter is at a higher resolution too, clocking in at about 100Mb. I may well use S3 for future public commercial downloads in the future too. It’s altogether more convenient than the block bandwidth allocations you get with regular hosting packages, since it scales dynamically at a very fine level of detail depending on demand. And don’t be fooled by ‘unlimited’ bandwidth offers, all hosting companies have to pay for bandwidth and there’s no such thing as ‘unlimited’ resources; you’ll actually find your bandwidth being throttled or cut off via a ‘reasonable use’ clause in the small-print; ‘unlimited’ is simply a marketing lure. If you want truly scalable guaranteed bandwidth, you have to pay for it.

Getting S3 media hosting working wasn’t that hard, but did require a few discrete steps. Firstly, you need to create a bucket in your S3 account which is all in lower case, is globally unique and is DNS-compatible; so for example I created a bucket called ‘’.

Then to make it all look nice you need to create a DNS CNAME entry to map a sub-domain of your site to that S3 bucket; in my case I mapped ‘’ to ‘’. That allows me to access any files I upload to that S3 bucket via ‘'. You do just need to set the ACLs on the files & the bucket to make sure public access is allowed.

Finally, if you want to stream video files via a Flash player from S3 to another domain, you also have to tell Flash that it’s ok for the content to be pulled in from a different domain. Create a file called ‘crossdomain.xml’ in the bucket, with these contents:

<cross-domain-policy><br /> <site-control permitted-cross-domain-policies="all"/><br /> </cross>

That allows the media to be accessed from anywhere - you can be more specific if you want but this is the simplest approach.

Once again I’m using the excellent FlowPlayer; my only issue with it is that the ‘buffering’ animation seems to not work all the time (so be patient if you’re viewing the high quality version).

Gotta love this cloud computing business 😀