Dynamically Setting Domain Name

Oct 25, 2011 at 11:59 AM

A common usecase is to have different domains for different developmenet environments eg. dev, test, production

Is there any way to set this without resorting to the 'typeless' method - thus throwing away all the power and advantages of using Simol?

Coordinator
Oct 25, 2011 at 1:01 PM

Sure, you just create separate AWS accounts for each environment. See this discussion.

Also, the typeless interface doesn't throw away all the benefits. Besides all the formatting, querying, spanning, etc. functionality you can still get back to your data class with just one additional line of code when you use the typeless operations:

    var employeeId = new Guid("6c0a37b4-9c59-49ce-95af-d01a66f9605d");
    ItemMapping mapping = ItemMapping.Create(typeof(Employee));
    PropertyValues values = simol.GetAttributes(mapping, employeeId);
    Employee e = (Employee) PropertyValues.CreateItem(typeof (Employee), values);

Oct 25, 2011 at 5:07 PM

Seperate AWS accounts for different SimpleDB domains doesn't work for us - since we have different S3 buckets in the same account for dev, test, prod.  We have different EC2 instances in the same AWS account for dev, test, prod.  It doesn't make sense to add additional accounts to AWS just for the purpose of keeping Simol happy about our different domains.

The code example you've given will work for us, but how do you set the domain using the typeless interface - I've not seen any code examples.

Coordinator
Oct 25, 2011 at 7:58 PM

The way you use S3 and EC2 really has no relation to how you use SimpleDB. You can set up separate accounts and only enable the SimpleDB service and--better yet--even have billing for all the accounts consolidated to your main AWS account. The dev and test accounts won't even cost you anything because of the free usage tier for SimpleDB.

You should set up separate accounts for your environments not because of Simol, but because it will make everything about development with SimpleDB much easier. (Do you really want to swap out domain names for every select query in your application? Or have the same level of data access control for all environments?)

Here is a previous discussion about how to dynamically set the domain name with the typeless interface.