Using Windows Azure with Amazon Simple DB
Posted on June 4th, 2009
I have a great real world example of something that needs to be run in the cloud. Currently I have 2 types of applications running. One type is a sentinel and the other is a listener. There are many of these running today across three data centers. I want to know when one of these services has stopped functioning correctly.
My test is going to be to build a worker role that can run in Azure, connect to Amazon’s Simple DB service and look for status information sent from these other services. This will show connectivity between two different cloud technologies and allow me to test the availability and notification services of Azure. For example, is this new worker goes offline – how do I get notified?
I’ll be using my SDB .NET Provider which I haven’t yet released to the public. It allows me to hide the implementation of the Simple DB code so I can switch it out as required. It includes all Amazon libraries as well as SQS and a .NET Membership provider.
Here is the initial code block.
We’ll write an object to Amazon and then see if we can fetch it. This is making use of Amazon’s web services. I specifically didn’t put any exception handling around this start method because I want to see what the Azure system does when something goes wrong. The provider was configured using an app.config file.
When I tried to run – problem:
System.Security.SecurityException Message=Request for ConfigurationPermission failed while attempting to access configuration section at …. – lucky for me controlling the section permissions can be done in the config file. I set my section to requirePermission=false.
I don’t seem to be able to use a config file to setup the provider so I’m going to cheat for now and setup a stand alone instance without any config files and we’ll see how that does :) I did notice I’m probably supposed to put all the required config xml in the service configuration file so I’ll do that next time.
Here is a screenshot of the output, works like a charm. A test object was written and retrieved from Amazon Simple DB.
A couple notes. If you rename your worker role don’t forget to update your service definition file and configuration file. There does appear to be a problem with the developer fabric. I write information event entries to the log and they were not showing up but I knew the role was running. After restarting the fabric the messages started to appear again so I’ll see if I can report that as an issue. As an FYI I used a System Timer object to trigger my code, works great too.
In my next post, I’ll try deploy this to the real cloud :)
Tags: Amazon, Azure
Filed under Software |
