chalice
Python Serverless Microframework for AWS
Chalice is AWS's Python framework for building serverless apps on AWS Lambda, you write plain Python functions with simple decorators and one command deploys the entire cloud infrastructure for you.
Chalice is a Python framework made by AWS for building applications that run on AWS Lambda, a cloud service where you pay only for the time your code actually runs rather than keeping a server running continuously. The idea is that you write Python functions, decorate them with a few special markers, and Chalice handles deploying all the necessary AWS infrastructure for you with one command.
The framework covers several common patterns. You can define HTTP endpoints that act as a REST API by decorating a Python function with the route you want it to respond to. You can define tasks that run on a schedule, like every five minutes, by decorating a function with a rate or cron expression. You can also trigger functions in response to events from other AWS services: a file uploaded to an S3 storage bucket can automatically call a function, and messages sent to an SQS message queue can do the same. Chalice also generates the required AWS permissions policies automatically when you deploy, which removes a common source of configuration errors.
Setting up a new project follows a short sequence: install Chalice via pip in a Python virtual environment, ensure your AWS credentials are configured, run chalice new-project to create a project folder with a starter app.py file, and then run chalice deploy to publish it. The deploy command creates the Lambda function, the API Gateway endpoint, and any other AWS resources the app needs, then prints out the live URL. Re-running chalice deploy after making changes updates the live deployment in place. The chalice delete command removes all the resources Chalice created.
Full documentation, tutorials, and an API reference are available at the project website. Supported Python versions match whatever AWS Lambda currently supports, which at the time of this writing ranges from Python 3.10 through 3.14.
Where it fits
- Build and deploy a REST API in Python that runs on AWS Lambda with no server to manage or pay for when idle.
- Schedule a Python function to run every five minutes on AWS without manually configuring CloudWatch Events.
- Trigger a Python function automatically whenever a file is uploaded to an S3 bucket.
- Process messages from an SQS queue using a Python function that Chalice deploys and wires up automatically.