Well, you are in love with Azure and you want to leverage the elastic scalability of Azure by hosting your Web content on Azure – Fair enough – by all means you should do that. I consider it ‘magic hosting’ and I encourage you to give it a spin. Having said that, hosting a dynamic website in a web role totally makes sense. You could have your data in Azure storage [Tables/Blobs] and if your data needs a RDBMS, you could use SQL Azure. you could delegate processing part to worker roles. you could do much more and It is amazing to see how each piece work together to do what we want them to do – and the best part is that each component is scalable! For instance you could have 3 instances of web role and 5 instances of worker role – you could scale up/ scale down whenever needed!

But what about hosting a Static Website? It does not need a data store + it does not need worker roles to process things – so basically, you have a website that needs no server side processing. Before I tinker with your brain cells, let me tell you web role is the recommended method – no doubt about it but let me suggest you an alternative. It has it’s own set of pros and cons and at the end of the day it’s up to you. Here is the alternative: <drum roll> One can host a Static website in Windows Azure Blobs </drum roll>.

Are you intrigued? I am sure you are – See, This is so because Blobs that are held in public container are accessible via Public URI ( over an HTTP connection ). So the Files (e.g. html files) are accessible via standard web browsers such as IE. FYI – a Blob can store not only html files but also PDF, word, images, videos, CSS, JavaScript, Silverlight and Flash content! So if you have cooked up your Food using above ingredients – try serving them in Azure Blobs.

But what’s the fun? Well,  if you don’t need dynamically generated pages – it turns out that Azure blobs can act as cost effective + scalable hosting environment.

Now, let me demonstrate you – let’s get our hands dirty. For the purpose of the blog post – I am just going to upload few Interlinked html pages. No big deal. Nothing Fancy. you can definitely try adding JavaScript to your site, add flash – etc. Make it fancier and get a Webby Award but I am Lazy – I am just going to demonstrate .html pages and then desert you. I promise.

here are the URI’s of all the wen contents for the website in a Public Container:

HTML Files:

http://paras.blob.core.windows.net/demo-site-solidq/default.htm

http://paras.blob.core.windows.net/demo-site-solidq/one.htm

http://paras.blob.core.windows.net/demo-site-solidq/two.htm

http://paras.blob.core.windows.net/demo-site-solidq/three.htm

Images:

http://paras.blob.core.windows.net/demo-site-solidq/1.jpg

http://paras.blob.core.windows.net/demo-site-solidq/2.jpg

http://paras.blob.core.windows.net/demo-site-solidq/3.jpg

This is How a Home page Looks in a IE:

Voila! it is working.  Just a note: you have to explicitly mention the default.htm at the end of the URI as blob storage is not able to figure out the default file to render when you do not mention the file. basically it does not support default documents – And no, there is no workaround.

Now, Let’s see the cost of Hosting a Blob storage. As of now, the following pricing model applies:

$0.15 per GB stored per month

$0.01 per 10,000 storage transactions

Also, to estimate the pricing, do check out pricing calculator to estimate costs.

Following are the considerations that I will address in the future blog posts because I am too lazy to write a huge blog post. Anyways, here are the considerations:

[1]. setting the correct Mime type for correct page rendering (Based on my experiments with loading our default page in Mozilla firefox)

[2]. Mapping our unfriendly azure storage domain name to a friendly domain name like xyz.com

[3]. Logging Blob Request.

[4]. handling Directory structure of the website (applicable for huge static websites – no kidding – such sites do exist)

I address [2], [3] and [4] here: Hosting a static website in Azure blobs – Addressing some of the considerations

I hope you liked the Blog Post – Do post your comments/Feedback. Or write to me. My email:

pdoshi [at] solidq [dot] com