For starters I’m a cloud skeptic, I think it’s too new and untested to make any real long term predictions about where it’s going to go, but having said that it looks very interesting, and if you don’t have the hardware it can be a very inexpensive way to have a very scalable application.
Signing up with Amazon
For starters go to http://aws.amazon.com/simpledb/ and click on the signup and create an account which requires a credit card, just so you know.
As far as the cost, it really is very reasonable to free, based on your monthly usage with the first 25 Machine Hours free and each additional hour costing $0.140, your first GB of storage is free with each additional GB costing $0.25 per GB Per month. For bandwidth your 1st GB of data upload is free with each additional GB costing $0.10; your first GB of download is free with the following price structure for additional download badwith
- $0.170 per GB - first 10 TB / month data transfer out
- $0.130 per GB - next 40 TB / month data transfer out
- $0.110 per GB - next 100 TB / month data transfer out
- $0.100 per GB - data transfer out / month over 150 TB
While setting up the account was easy, there site is confusing, hard to navigate, and frustrating, my biggest complaint is I have to resign in constantly.
Getting the Amazon Tools
Finding the C# Library for Amazon SimpleDB is a pain, so I’m kindly providing you a link, now this is just source code, which is kind of irritating, why can’t they just give me the DLLs, but on the other side I can look at what they are doing, and how they do it.
Using the Amazon Tools
The first thing to do is build a proxy for interfacing with the simpleDB web service, something like this
This class provides several things, first it sets the public and secret keys for simpleDB, this is basically your authentication to simpleDB, as you can see I’m using an app setting to store this. The next important thing is the AmazonSimpleDBClient property called service, this is how you interact with simpleDB. Last you have the Domain methods, these are used to get what domains you have, add new domains, and finally delete unused domains.
Now we have our proxy lets build something that uses it
Here we have a simple example of how to add/get items from simpleDB, one important thing to note is the IDs are GUIDs, this is because the objects don’t get and incrementing index ID you need to get a unique identifier and the easiest way to do that is to just used a GUID.
One thing you will notice is I have added some extension method helpers for getting the data out, this is just a way to simplify getting your data back out.
SimpleDB has some very interesting abilities, primarily the ability to not have to manage your DB structure, worry about indexes, and all of the other DB stuff most devs don’t want to deal with, you simply take whatever objects you have and put them into the DB, and pull them back out. The cloud has some unknowns(security, reliability, etc.) but i think this is definitely a technology to keep your eye on, and last here is the source for the sample application (source), just keep in mind this sample application isn't done and the source is subject to change.