AWS Lambda for Python with "Chalice"

Chalice is a microframework for Python for AWS Lambda, similar in spirit to Flask. What does that even mean?

A framework is a set of libraries and coding conventions that makes development in a specific language for a specific task easier. That usually involves making some simplifying assumptions about the task you are trying to solve, and embedding those assumptions in your code so that you don’t have to spell out quite as much detail to get a task done.

A microframework is a small version of a framework, and the work echoes the current 2016 in-favor design principle of microservices, where instead of building some all-singing, all-dancing monolithic application that does everything, you figure out some components that can stand alone and be simplified away from the big thing so that they can change faster.

What do you do with a microframework for Python for AWS Lambda? Well, you develop microservices in Lambda. Lambda is a hosting environment on Amazon Web Services that is ideal for very short lived processes or even just function calls that last a few seconds (“micro”) and get just a few things done.

With Chalice, you are carefully guided through the process of setting up your first microservice in Python. It comes out of the box with sample code to do a “hello world” service, and from that sample code the entire set of Lambda packaging is built for you. There are a surprisingly large number of moving parts to actually get a Lambda function running; Chalice’s build system hides most of those from you at the start.

The code is available on Github, either to run as-is, to fork for your own edification, or simply to study. I’ve gotten as far as hello, world, but no farther than that yet. There are lots of warnings to the effect of “not yet ready for production use!” so use with care.