AWS Developer Blog

Preview the Python Serverless Microframework for AWS

by Peter Moon | on | in Python | Permalink | Comments |  Share

Serverless computing is one of the most talked-about subjects among AWS customers. The AWS serverless offerings, AWS Lambda and Amazon API Gateway, make it possible for developers to create and run API applications with built-in, virtually unlimited scalability without managing any servers. Today the AWS Developer Tools team is excited to announce the preview of the Python Serverless Microframework for AWS.

This three-minute video shows how quickly you can start building serverless APIs using the framework and its command-line tool, chalice.

In just 45 seconds, I created a new Hello World project, inspected its code file (app.py), deployed it to a public API endpoint, and using curl, made a successful HTTP GET request to the endpoint. Because our goal is to minimize the time it takes to get started, we hope you’ll enjoy the simple and fast experience offered by the new microframework.

In the next minute of the video, I added a new API feature to the app.py file, redeployed the API, and then verified that it works as expected.

If you’ve noticed the programming model feels familiar, that’s because it’s based on the one used by Flask, a popular Python microframework praised by the Python community for its simplicity and ease of use. We believe adopting a similarly succinct and intuitive style will help Python developers build serverless APIs as quickly as possible.

In the last part of the video, you’ll see how the framework makes it easy to consume AWS Lambda’s built-in logging feature available through Amazon CloudWatch Logs. Using the chalice logs and chalice deploy commands together, you can iterate quickly over test-diagnose-fix-deploy cycles in a live environment. The chalice deploy command can optionally take a deployment stage name, and you can deploy different versions of your code to different stages. Using this feature, you can leave your production stage intact while modifying your development stage. Then you can deploy to the production stage when the changes are ready to go out.

The Python Serverless Microframework for AWS is available on PyPI (pip install chalice) and GitHub (https://github.com/awslabs/chalice). It is published as a preview project and is not yet recommended for production APIs.

We look forward your feedback and suggestions. Feel free to leave comments here or come talk to us on GitHub!