I've had a few goes at making a blog in the past, all of which have come and gone. The common element between them all was that they were all using Wordpress, a fantastic PHP content management system.
I always loved Wordpress, it's easy enough to start that you can let clients manage their own content but powerful enough that I've never felt constrained by it when trying to do more customised modifications. So, naturally, when I recently had a need for a blog, I reached for Wordpress.. And then I stopped..
I've never been one to get overly excited by new frameworks or latch onto new languages, telling people how much I love all the new monad burritos that I now have. I've always been more attracted to mature languages and the rich libraries they offer. But there are always exceptions, and lately that exception has been AWS Lambda.
Lambda is a product from Amazon Web Services which allows you to run code in certain langauges without concerning yourself with servers. Essentially you can focus on being a developer and pumping out software without concerns like
- How do I deploy this?
- Is my server up to date?
- Has my server crashed at 3am on a Sunday?
- Why am I paying monthly for a whole vps to serve 1k requests a day?
I recently gave a talk on the benefits of AWS Lambda, which you can watch here.
Lambda Powered Blog
So I was wondering how practical it would be to get Wordpress or some other Python CMS running on Lambda. I had low hopes, Lambda isn't designed for file uploads or file serving, even with a wrapper around them, none of the premade solutions were going to work.
Instead, I set out to make my own super-simple, serverless blog designed from the ground up. How'd it go? You're reading this article on it right now!
So this blog is written in Python using Mako for templating and Markdown to let me write articles in a simple format. On top of that, it's open source on my Bitbucket.
The most sensible choice for a CMS is a relational database, however for this project I'm starting out on AWS DynamoDB.
DynamoDB is a poor choice for a CMS as its primary datastore because you have no ability to search and end up doing a full scan every time you want to list articles, which scales horribly with the number of articles. The reason I went with it to start with is that I've been wanting to play with it for a while; I've always been a big fan of relational databases and have been urged in the past to try NoSQL.
The blog will move to a relational database at some point in the future, but for now, when I have very few articles and no search, DynamoDB offers amazing scalability, availability, and costs literally nothing.