Category Archives: API

Python Serverless Microframework

AWS has introduced a Python serverless microframework.  It’s a beautiful concept, making it super simple to create and deploy an APIs with infinite scalability.  It does so by leveraging the Amazon API Gateway and AWS Lambda without the learning curve.  That said, the ideal use case for the frameworke is for rapid prototyping or highly scalable deployment of a very simple rest API.  It’s the right choice as long as the API you need is a good candidate for development using Python with Flask-like view decorators.

The framework is accessible via the Chalice GitHub repository, providing a CLI (command line tool) for creating, deploying, and managing your app.  All  you need to deploy a new API is to put your app in a Python file.  How little effort is needed to get going?  How about this…

pip install chalice
chalice new-project
chalice deploy

Now you’re ready to hit the endpoint you configured!

(Note that as a tradeoff for simplicity, not all API Gateway and Lambda services are exposed to Chalice.  There is a simple way to consume AWS Lambda’s built-in logging via Amazon CloudWatch Logs.)