Microframework
Project description
Chalice is a microframework for writing serverless apps in python. It allows you to quickly create and deploy applications that use AWS Lambda. It provides:
A command line tool for creating, deploying, and managing your app
A decorator based API for integrating with Amazon API Gateway, Amazon S3, Amazon SNS, Amazon SQS, and other AWS services.
Automatic IAM policy generation
You can create Rest APIs:
from chalice import Chalice
app = Chalice(app_name="helloworld")
@app.route("/")
def index():
return {"hello": "world"}
Tasks that run on a periodic basis:
from chalice import Chalice, Rate
app = Chalice(app_name="helloworld")
# Automatically runs every 5 minutes
@app.schedule(Rate(5, unit=Rate.MINUTES))
def periodic_task(event):
return {"hello": "world"}
You can connect a lambda function to an S3 event:
from chalice import Chalice
app = Chalice(app_name="helloworld")
# Whenever an object is uploaded to 'mybucket'
# this lambda function will be invoked.
@app.on_s3_event(bucket='mybucket')
def handler(event):
print("Object uploaded for bucket: %s, key: %s"
% (event.bucket, event.key))
As well as an SQS queue:
from chalice import Chalice
app = Chalice(app_name="helloworld")
# Invoke this lambda function whenever a message
# is sent to the ``my-queue-name`` SQS queue.
@app.on_sqs_message(queue='my-queue-name')
def handler(event):
for record in event:
print("Message body: %s" % record.body)
And several other AWS resources.
Once you’ve written your code, you just run chalice deploy and Chalice takes care of deploying your app.
$ chalice deploy ... https://endpoint/dev $ curl https://endpoint/api {"hello": "world"}
Up and running in less than 30 seconds. Give this project a try and share your feedback with us here on Github.
The documentation is available on readthedocs.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for mod_chalice-1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 512093dfaa670b045550f239233896b5ea6a687ba6b1097ff8e13190012e1c6a |
|
MD5 | 7f7f2e9be357bf31eaf02b05d5e05ff3 |
|
BLAKE2b-256 | 21ccbf07c965d75cf5a35a873e34cdde586bddc552debaa07cb9978536b9c4e7 |