Earlier this week I began implementing a DynamoDB solution for a client. DynamoDB is a NoSQL solution long ago planned but only recently released on Amazon Web Services. It is more closely related to Cassandra than MongoDB or CouchDB but offers some interesting and enticing features (e.g., all DynamoDB tables exist on SSDs, so the I/O is pretty damn fast!).
My client's site is built with CFML and runs on Tomcat/Railo 3.3.1 (to be upgraded to 3.3.2 this weekend) on a load-balanced EC2 instance that employs several other AWS services, such as a MySQL DB on RDS, S3, CloudFront and the new ElastiCache. While our RDS database serves most of our needs, some of our data is quite complex and we feel we would better served breaking some items out into a NoSQL solution.
After an initial review of NoSQL options, we thought we'd go with MongoDB but, with the announcement of DynamoDB, we decided that it would be a better choice for our team because all DynamoDB instances are managed by Amazon's experts ... and this seemed a might better option than building and managing our own MongoDB cluster!
As many/most CFML developers know, there is no CFML SDK for Amazon Web Services. And, if you want to write CFML code to directly access AWS services such as DynamoDB, it can be a pain in the ass, to say the least.
Why such a pain? Primarily because you have to manage your security credentials and session tokens yourself/in your CFML code and none of these actions are straight-forward or easy. Plus, it ends up pretty non-CFMLy because it requires a shit-ton of code (IMHO). The pre-built AWS SDKs, on the other hand, handle all these security actions for you.
Fortunately, there is an AWS Java SDK, as I am sure you all know. And, thankfully, we CFML developers can (fairly) easily access and use Java APIs/libraries directly in our CFML code. Hooray!
So, to make my life easier, I created and started working on a project I named CFDynamo (yep, typically uninspired CFML project name :). To start, I have integrated the security aspect (i.e., enabling CFDynamo to access your DynamoDB instance) and table listings. To get started quicker, I created a couple of tables in the AWS console.
If you are interested in the project, please check it out on Github. The README contains instructions for getting the Java SDK setup and running on either Tomcat/Railo or ACF 9. I won't bore you with more setup details here.
I'll be adding more API functions/calls to CFDynamo between today and Monday. Feel free to watch the Github repo for updates, which should come in the following order:
- refine putItem
And, of course, please fork the project and make some better coding updates than I will and I can merge your pull requests!