CLI tool
aws/chalice avatar
aws/chalice

AWS Chalice: a Python microframework that turns decorators into Lambda and API Gateway resources

Python Serverless Microframework for AWS

11,054 stars1,014 forksPythonApache-2.0

At a glance

What is it?
Chalice lets Python developers declare routes, schedules and event handlers with decorators, then deploy them to AWS Lambda with a single command. It suits small teams that want serverless without writing CloudFormation by hand, and it is a poor fit for anyone who needs control over every deployed resource.
Who is it for?
Adopt Chalice if you are a Python team shipping HTTP endpoints, scheduled jobs or S3 and SQS handlers on AWS and you would rather write decorators than CloudFormation. Do not adopt it if you need to inspect or hand-tune every generated resource, or if you are not deploying to AWS at all.
Can I use it commercially?
Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 19 days ago.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 30, 2026, and from our analysis. They are not legal advice.

Editorial analysis

The problem Chalice solves for Python teams on AWS

Writing a Lambda function is easy. Wiring one up is not. A single HTTP endpoint on AWS normally means a Lambda function, an API Gateway resource, a method, an integration, a stage, a deployment, and an IAM role with a policy that grants exactly the permissions the function needs. Each of those is a separate resource with its own configuration surface, and each one can be wrong in a way that only shows up at runtime.

Chalice compresses that into Python. The README describes it as a framework for writing serverless apps in Python, with three stated pieces: a command line tool for creating, deploying and managing the app, a decorator based API for integrating with Amazon API Gateway, Amazon S3, Amazon SNS, Amazon SQS and other AWS services, and automatic IAM policy generation. The audience is a Python developer who already knows AWS but does not want to maintain a template for every function.

The decorator API is the whole pitch. A route is a function with @app.route on it. A scheduled job is a function with @app.schedule and a Rate object. An S3 trigger is @app.on_s3_event(bucket="mybucket"). An SQS consumer is @app.on_sqs_message(queue="my-queue-name"). The README shows all four. What the developer writes is ordinary Python; what AWS receives is generated infrastructure.

How the decorator API maps onto Lambda and API Gateway

The mechanism is code generation. A Chalice application is a module that constructs a Chalice object, conventionally named app, and attaches handlers to it with decorators. The README's minimal example is a Chalice instance created with app_name="helloworld" and a single @app.route("/") function returning a dictionary. Chalice treats the return value as the response body, which is why the README can show curl returning {"hello": "world"} directly.

The CLI reads that module and produces a deployment package, then creates the AWS resources the decorators imply. The README's deploy transcript shows the sequence plainly: Creating deployment package, Creating IAM role: helloworld-dev, Creating lambda function: helloworld-dev, Creating Rest API, then a list of resources deployed with a Lambda ARN and a Rest API URL. The -dev suffix is not decoration; it is the stage name, and it is why the same app can exist in more than one stage.

Automatic IAM policy generation is the part worth pausing on. Chalice infers permissions from the decorators and the code rather than asking you to write a policy document. That removes a common source of deployment failures, and it also means the policy is a derived artifact. If you need a permission the framework does not infer, the README does not describe how to add it, so treat that as a gap to check in the documentation before you rely on it.

Installing Chalice and deploying a first endpoint

The README's quickstart targets Python 3.10 and notes that Chalice supports the Python versions supported by AWS Lambda, which it lists as 3.10 through 3.14. The setup.py in the repository sets python_requires to >=3.10, so anything older will refuse to install. Start by creating and activating a virtual environment, then install from PyPI.

bash
python3 -m venv .venv
. .venv/bin/activate
python3 -m pip install chalice
chalice --help

The final command should print the CLI usage block, which is how the README suggests confirming the install. Next, credentials. If you already use boto3 or the AWS CLI on this machine, the README says you can skip this step. Otherwise it gives a config file with an access key, a secret key and a region.

bash
mkdir ~/.aws
cat >> ~/.aws/config
[default]
aws_access_key_id=YOUR_ACCESS_KEY_HERE
aws_secret_access_key=YOUR_SECRET_ACCESS_KEY
region=YOUR_REGION

Now generate a project. The new-project command creates a directory containing app.py, requirements.txt and a .chalice directory. The README says to ignore .chalice for now, but it is where the framework keeps its own configuration, so it is worth opening once you are past the tutorial.

bash
chalice new-project helloworld
cd helloworld

The generated app.py defines one route, /, returning {"hello": "world"}. Deploying from inside that directory creates the IAM role, the Lambda function and the REST API:

bash
chalice deploy
curl https://abcd.execute-api.us-west-2.amazonaws.com/api/

The curl call should return {"hello": "world"}. The README notes that you can edit the returned dictionary and run chalice deploy again to push the change. When you are finished experimenting, chalice delete removes the resources the framework created.

What you give up when the framework owns the resources

The trade is control. Chalice creates the IAM role, the Lambda function and the REST API on your behalf, and the README presents this as the point of the tool. The consequence is that the deployed infrastructure is an output of your Python, not something you author. If your organisation requires every resource to be reviewed as a template before it reaches an account, Chalice inverts that workflow.

The README does not document rollback. There is no described mechanism for reverting a bad deploy to the previous version, and no described way to preview the resource changes a deploy will make before it runs. That is a real gap for production use, and it is not something you can infer your way around from the quickstart. The documentation is where you would need to confirm whether such a feature exists.

There is also a packaging constraint. The generated project includes a requirements.txt, and setup.py pins a set of dependencies including botocore, click, pyyaml and inquirer. A framework that vendors its own botocore layer has opinions about the AWS SDK version in your deployment package, and those opinions can collide with a library you already depend on. The README does not discuss that collision.

Finally, the scope is AWS. The decorators are named for AWS services, the CLI deploys to AWS, and nothing in the README suggests another target. If your workload runs on another cloud, or on Kubernetes, Chalice is the wrong tool and no amount of configuration changes that.

Chalice versus Goblet, and what the difference in approach means

The closest comparison in Python serverless tooling is Goblet, which people search for alongside Chalice. The two sit on opposite sides of the same trade. Chalice is a framework whose CLI generates and manages AWS resources from decorators, with an application object at the centre and a deploy command that provisions what your code implies. Goblet is built around the same decorator style but takes infrastructure-as-code as its foundation, so the resources are expressed rather than inferred.

That difference shows up in what you can review. With Chalice, the IAM role and the API Gateway resources appear after the fact, in the deploy output and in the AWS console. With an infrastructure-first tool, they exist as declarations you can read, diff and store in version control before anything is created. Neither is strictly better; they optimise for different things. Chalice optimises for time to first endpoint, which the README measures in its own words as up and running in less than 30 seconds. An infrastructure-first tool optimises for the moment six months later when someone asks why a function has a particular permission.

If you are evaluating both, the question to ask is not which is faster to start. It is whether your team needs to see the resources before they exist. If yes, Chalice's central design decision works against you, and no amount of decorator convenience compensates.

Maintenance, licensing and what a Chalice upgrade costs

Chalice is an AWS-owned project under the aws organisation on GitHub, licensed Apache-2.0, with the licence file at LICENSE and a NOTICE file in the repository root. Apache-2.0 is permissive: it allows commercial use, modification and redistribution, and it includes a patent grant. It also requires that you preserve the licence and notice files when you redistribute. That is a description of the licence text, not legal advice; if you are embedding Chalice in a product, have your own counsel read the terms.

The repository is not archived, and the last push was on 2026-09-11. The setup.py declares version 1.33.0 and requires Python 3.10 or newer. The README states that Chalice supports all versions of Python supported by AWS Lambda, which it lists as Python 3.10 through Python 3.14, so the framework tracks Lambda's runtime calendar. That is a maintenance cost you inherit: when Lambda drops a runtime, you upgrade Chalice or you stop deploying.

The dependency pins are the other recurring cost. setup.py constrains click to >=7,<9.0, botocore to >=1.14.0,<2.0.0, pyyaml to >=5.3.1,<7.0.0, and pip to >=9,<26.2. Those upper bounds mean a major release of any of them requires a Chalice release before you can move. There are also optional extras: an event-file-poller extra pinning watchdog==2.3.1, and cdk and cdkv2 extras for teams that want to deploy through the AWS CDK instead of the default deployer. The Makefile shows the project's own quality gates, including flake8, pydocstyle, pylint, mypy with --disallow-untyped-defs, and a test suite split across tests/unit, tests/functional and tests/integration.

Editorial conclusion

Adopt Chalice if you are a Python team shipping HTTP endpoints, scheduled jobs or S3 and SQS handlers on AWS and you would rather write decorators than CloudFormation. Do not adopt it if you need to inspect or hand-tune every generated resource, or if you are not deploying to AWS at all. Before committing, run chalice new-project in a scratch directory, deploy it once, and read the generated .chalice directory and the IAM role it creates, because that is where the framework's opinions become visible.

Frequently asked questions

How do I install AWS Chalice?

The README's quickstart creates a virtual environment, activates it, and runs python3 -m pip install chalice. You can confirm the install by running chalice --help, which should print the CLI usage block. Chalice requires Python 3.10 or newer according to setup.py.

How do I use AWS Chalice to create a REST API?

Run chalice new-project to generate a directory with an app.py, then define a function decorated with @app.route("/") that returns a dictionary. Running chalice deploy creates the IAM role, the Lambda function and the REST API, and prints the API URL. The README shows the endpoint returning {"hello": "world"}.

What AWS services can AWS Chalice connect a Lambda function to?

The README lists Amazon API Gateway, Amazon S3, Amazon SNS, Amazon SQS and other AWS services. It gives examples for HTTP routes with @app.route, periodic tasks with @app.schedule and a Rate object, S3 uploads with @app.on_s3_event, and SQS messages with @app.on_sqs_message.

Does AWS Chalice manage IAM permissions for me?

Yes. Automatic IAM policy generation is one of the three capabilities the README lists, alongside the CLI and the decorator API. The deploy transcript shows Chalice creating an IAM role named after the app and stage, such as helloworld-dev, without the developer writing a policy document.

How do I remove the resources AWS Chalice created?

The README states that the chalice delete command will delete all the resources the framework created for the app. It presents this as the cleanup step once you are done experimenting with Chalice.

Official sources

  1. aws/chalice on GitHub
  2. Issues
  3. License: Apache-2.0
  4. README
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/aws-chalice.svg)](https://hysenlabs.com/projects/aws-chalice)