Mindlessly browsing reddit I came across this comment and marked it as an interesting idea for a small project. Basically, making a tool that allows you to create guess-who-tweeted it quizzes easily.

I’ve forgotten about it for a long time, but found it recently when searching for project ideas to implement as practice using react.js. My original plan was not to publish it, as twitter’s rate limits basically mandate using some sort of server-side caching and I didn’t feel like deploying and paying for a server somewhere for a simple toy project.

Enter AWS Lambda

I’ve always been a big fan of the new and upcoming cloud technologies, and have been playing around with every new thing that Amazon throws out since the days of AWS MapReduce.

I’ve found that the EC2 instances can be a bit pricey by themselves, but using them in conjunction with the other, more “cloudy” services, such as DynamoDB or S3, is where the real time/money saver is.

However, with the introduction of AWS Lambda we can even get rid of that and have a massively scalable, persisted, serverless deployment.

Lambda allows you to run pieces of code, which can take some inputs, and return outputs, triggered by custom events. The events can be AWS-internal, such as reaching 80% read/write capacity for DynamoDB, or, even more exciting, when paired with AWS Api Gateway, actual HTTP requests.

You don’t have to deal with deployment scripts, ssh keys, security patching or anything, just code you throw at AWS and say “hey, when this happens, run this code.” Awesome.

tweez.io is born

tweez.io (as in twitter quiz, it’s bad, I know) architecture started brewing in my head. Basically, serve static content from S3 and dynamic content (game creation and caching) using Lambda and DynamoDb for persistence. Maybe not the most creative use of it, but definitely functional.

why is “the Internet” always a cloud?

Observations

I really like this approach to building Web services. Of course, if you’re building some mission-critical software that requires sub-millisecond latency, you’d roll out your own backend and fine-tune the GC, but for a lot of Web projects or startup MVPs this is more than enough.

Not only can you just focus on the code, the API Gateway allows you to define your API, and serve mock responses from each endpoint-HTTP method pair, and gradually replace those mocks with lambda calls.

Other thing I like is that you dynamically specify which function in the module to call (I was using Python), so you can use just one module and attach different lambda functions to different module methods, while sharing a lot of code/functionality between them.

On top of all that, the AWS Free Tier gives you a number of those resources for free, for a year. That Free Tier should be enough to get you through validate-your-idea-and-get-some-users phase and then some.

I honestly think this is the future of building online services, and will definitely try to use it as much as possible. Even if the cost of the server deployment might be a bit higher than keeping the server somewhere in your own closet, the cost of a salaried engineer is so high, that any time saved will probably pay itself off.