Wednesday, 19 November 2008

Silverlight: Amazon CloudFront

I’ve been looking at Amazon CloudFront today, and it seems to me that Amazon is aggressively going for the CDN market.

This really is a CDN (Content Delivery Network) solution (and it’s cheap). All it is a method of serving up assets (images, documents, html, even Silverlight) with low latency by using a delivery network (so if your user is in hong kong, the asset will be served from the hong kong server).

The good news is that it is ridiculously cheap. 17 cents per GB data transfer, and 1 cent per 10,000 requests.

Silverlight

It also seems to me (although I haven’t tried it yet), that if you wanted to host your Silverlight application within Amazon CloudFront you could do so. You could have an HTML page (hosted in CloudFront), assets (hosted in cloudfront), silverlight XAP file (hosted in CloudFront), and then you could even allow calls to a back end web service (hosted in azure, or your normal boring old web server) via cross domain policies.

UPDATE: This is confirmed as working, be careful with setting your Content Types, see Tim Heur's comments in the comment section of this post. Thanks Tim.

Azure

I think once Microsoft have setup their many data centers, I would expect a similar type of offering from Azure also. To be honest I don’t think Azure is too far away from this. All Microsoft need to do is provide multiple datacenters, allow us to control the cache for Blob Storage Services, and use the closest data center to server up public url’s. To offer this a separate offering from Azure’s point of view would be wrong (i think).

I think that the competition between Amazon and Microsoft in the cloud space is going to be really great, and will drive down the cost of hosting / scaling.

6 comments:

timheuer said...

I totally agree of this awesomeness. One challenge right now with CloudFront/S3 is that although the content (XAP) can be delivered fine, it is with an incorrect MIME type. I'm working with their team to get application/x-silverlight-app added and then this will be superb!

chrishayuk said...

Thanks Tim,

When I wrote this article, that was the only stumbling block I could foresee however I assumed that since Silverlight had been around for a bit that Amazon would have got this right.

Good job on trying to sort that out with them, I really think this is game changing news for us. I just hope the azure team takes note.

timheuer said...

I actually just resolved this (with their help/knowledge). One thing I didn't know was that upon upload of content to S3, *you* control the content-type header that is sent. Most tools like S3Fox, etc. do this automatically (not sure if they have a dictionary of known types). But there is one tool BucketExplorer that does allow you to set this on upload. And of course the API allows you to set this. So I'm going to modify the tool I use.wrote (S3Browser) to enable this option. I've also written to the author of S3Fox to see if he can enable that. Either way, now that I know this, it works! Thanks to Mike Culver at Amazon for showing me the mistakes of my thinking!

chrishayuk said...

Great Job Tim :)

This is pretty similar to Windows Azure's Blob Storage service where you get to set the content type on upload of the blob.

timheuer said...

Just a follow-up report. I modified S3Browser (http://codeplex.com/s3browser -- get the source not the latest release) to enable this option. I really need to make a stand-alone app of that same code instead of just a Live Writer plugin...but it works :-). S3Fox is in the process of evaluating adding this override feature. BucketExplorer (not free) has support for adding metadata headers to any upload. I've now tested and confirmed! Too bad CloudFront doesn't have request reporting yet though.

chrishayuk said...

Thanks Tim,

I think everyone will agree with me that the Silverlight community is lucky to have Tim as an evangelist :)

Great Job