DynamoDB and Botkit

emojination_64I recently built (on top of the Botkit framework) and launched a Slack chat based game, emojination. I started out running emojination on Heroku. It was cheap and fast to get up and running there. Heroku does some really nice things for developers that shields the complexity of Amazon’s AWS. However, once I had emojination running well enough on Heroku, I wanted to learn AWS better. I knew about some of the services at a high level and used some of them on projects operationally, but I had never built anything on top of them myself.

I could run everything on “native” Amazon AWS services except Redis, which I was using for Botkit’s storage. While Amazon has a Redis based service, it is meant for caching. I could run Redis on EC2, either running the setup myself or using a 3rd party that makes it simpler to setup and maintain. While those options were reasonable, I wanted to see if I could make use of Amazon’s DynamoDB, since it’s a perfect match for the job (a key/value store), doesn’t require ops overhead on my part, and comes with some AWS free tier incentives. Yep, lock me up in the trunk and throw away the key.

The only problem was that there wasn’t a Botkit storage module for DynamoDB. There was one for Redis, MongoDB, Firebase, etc. but no DynamoDB. Seeing as I have near zero Node.js skils, I thought, “how hard can it be to create the DynamoDB Botkit storage module?” Not too hard, as it turns out, except for the part where I need to still figure out how to get the tests passing where promises are involved. The bulk of my time was spent figuring out how DynamoDB worked and what the options were in regards to npm DynamoDB modules. I ended up using the Dynasty module, which has a nice promise based approach. I found a few surprises along the way working with DynamoDB, but everything is running smoothly now, with emojination using it for both read and write operations.

The end result is there is now a botkit-storage-dynamodb module available for all who are interested in using DynamoDB with their Botkit based bot. A small contribution that has helped me learn quite a bit in a short period of time. ❤️

Leave a comment