A comparison between AWS Chalice and AWS SAM¶
AWS Chalice is a microframework for writing serverless apps in Python.
The following table provides a mapping between AWS SAM and AWS Chalice commands:
Chalice |
Main options |
Notes |
SAM equivalent |
---|---|---|---|
|
initialize an "hello world" sample project at the dev stage |
|
|
|
|
Chalice automatically builds apps, storing the build results in |
|
|
|
locally run the app (by default on port 8000) |
partially covered by |
|
invoke a Lambda function |
partially covered by |
|
|
redirect to stdout the auto-generated AWS policy for the defined app (useful as a starting template for |
||
|
delete the deployed app |
The following sample is the Chalice implementation equivalent of SAM project discussed here.
chalice-app/
│
├── .chalice/
│ ├── deployed/
│ │ └── <stage_name>.json
│ ├── deployments/
│ ├── policy-<stage_name>.json
│ └── config.json
│
├── chalicelib/
│ ├── __init__.py
│ └── custom_script.py
│
├── app.py
│
└── requirements.txt
where app.py
contains (possibly) all the Lambda handlers, each one decorated with @app.lambda_function(name='my_lambda_name')
, needed to let Chalice treat them as pure Lambda functions.