Silverlight apps are nothing more than big zip files and Amazon S3 is dirt cheap and hyper-scalable. Why would you ever host your Silverlight .xap files on your own server or ISP? … especially with Silverlight Streaming being dropped soon.
Here’s a quick guide to putting your Silverlight apps on Amazon S3 and depending on your app, never worry about scalability or bandwidth costs again…
1) Create your Amazon S3 account.
2) Install S3 Organizer FireFox plugin (this is the equivelent of an FTP client for Amazon S3).
3) Run S3 Organizer, log into your account and create your bucket.
4) Upload your xap file to your bucket. BUT… you must add custom headers unless you are also going to host your .html file there too. Silverlight xaps need a MIME type specified when they are loaded from another domain. The good news is, this is easy with S3 as long as you do it at the time that you upload the file. There is probably a way to set it after the fact but not with S3 Organizer.
Simply set the content type to ‘application/x-silverlight-app’ and send up your xap. Don’t forget to do this EVERY time you upload an update.
5) After uploading your .xap file, set permissions so everyone can read your xap file. Right click on your newly uploaded xap file and choose “Edit ACL…”. Then check Read access for Everyone and Authenticated Users. You do NOT need to do this every time as S3 remembers your ACL settings.
6) Add the enableHtmlAccess param to your object tag within your html file to enable access to the DOM bridge (assuming your Silverlight app needs access to the DOM bridge).
For example:
7) Change your html page to load your xap file from S3 directly by setting the source param in your object tag.
For example:
Note: ‘mybucket’ is the name of your bucket on S3.
8 ) Upload your html (or aspx) page to your web server. GoDaddy.com offers cheap hosting for only $5 per month.
That’s it! At this point, the only scalability concerns you should have are those of your web services (assuming you call web services from your Silverlight app).
And with S3, the costs depend on the usage — which will literally cost you just pennies per month until you have some descent traffic. Do the math and you’ll see that it would only cost 17 cents to have a 300K .xap get hit 3500 times. At that rate you’d pay ~$48 to have 1 million new users per month. (I say “new” users because unless you update your xap, users should be caching your xap file and won’t need to re-download it).
Happy cheap hosting and Silverlight coding!
I always enjoy learning what other people think about Amazon Web Services and how they use them. Check out my very own tool CloudBerry Explorer that helps to
manage S3 on Windows . It is a freeware. http://cloudberrylab.com/
You can get S3 hosting easier and for free by using DropBox. Read my blog post about that: http://kodierer.blogspot.com/2009/10/live-silverlight-streaming-being.html
Wow, great article.
If you will need to handle big amount of files you can give a try to S3 Browser – http://s3browser.com – Amazon S3 Client for Windows.
It was designed to handle millions of files effectively.
Thanks for the post (pics do help) and the idea to store the .xaps and other binary files (images/audio) on S3 is really a good one. Then I just need the Web Services on my cheap hosting site and everyone is happy. For a small/medium-sized Silverlight app this is ideal.
Now I just need to see what hosting the Web Service and data in the cloud would cost (and see if I trust it yet).
Thanks again. Bruce
Thanks for this post Tim.. great ideas, and takes some of the mystique out of Amazon S3. For some reason I thought it would be more of a pain to use.
Great idea. Can Amazon also host a WCF service, and some kind of database (something that .net can connect to) ?
Enrique, you can host a WCF service or database with Amazon EC2 but not with Amazon S3. S3 is just a cheap file storage option. EC2 will run you almost $100 / month minimum unfortunately. Here’s a blog post I wrote earlier about EC2 vs Mosso vs Azure. https://programmerpayback.com/2009/02/04/scalable-windows-hosting-mosso-vs-ec2-vs-azure/
Thanks for that, I’ll spend some time reading the rest of your posts (all well written). Now that Azure pricing is out maybe you can do a follow-up article 🙂
It is in reality a great and helpful piece of information.
I am happy that you shared this helpful info with us. Please
stay us informed like this. Thank you for sharing.
It is in point of fact a great and helpful piece of info.
I’m happy that you just shared this helpful information with us.
Please stay us informed like this. Thank you for sharing.