AWS Lambda event handler manager
Project description
Domovoi is an extension to AWS Labs Chalice to handle AWS Lambda event sources other than HTTP requests through API Gateway. Domovoi lets you easily configure and deploy a Lambda function to run on a schedule or in response to an SNS push notification:
import json, boto3, domovoi
app = domovoi.Domovoi()
@app.scheduled_function("cron(0 18 ? * MON-FRI *)")
def foo(event, context):
context.log("foo invoked at 06:00pm (UTC) every Mon-Fri")
return dict(result=True)
@app.scheduled_function("rate(1 minute)")
def bar(event, context):
context.log("bar invoked once a minute")
boto3.resource("sns").create_topic(Name="bartender").publish(Message=json.dumps({"beer": 1}))
return dict(result="Work work work")
@app.sns_topic_subscriber("bartender")
def tend(event, context):
message = json.loads(event["Records"][0]["Sns"]["Message"])
context.log(dict(beer="Quadrupel", quantity=message["beer"]))
Installation
pip install domovoi
Usage
First-time setup:
chalice new-project
Replace the Chalice app entry point (in app.py) with the Domovoi app entry point as above, then deploy the event handlers:
domovoi deploy
To stage files into the deployment package, use a domovoilib directory in your project where you would use chalicelib in Chalice. For example, my_project/domovoilib/rds_cert.pem becomes /var/task/domovoilib/rds_cert.pem with your function executing in /var/task/app.py with /var/task as the working directory. See the Chalice docs for more information on how to set up Chalice configuration.
Links
Bugs
Please report bugs, issues, feature requests, etc. on GitHub.
License
Licensed under the terms of the Apache License, Version 2.0.
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
File details
Details for the file domovoi-0.0.6.tar.gz
.
File metadata
- Download URL: domovoi-0.0.6.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 32855a913235f17a170f370bcba90fcd22d0e3a6f82c6d00eb4f590f962b8683 |
|
MD5 | 2687aae1193aeea284374edc0fae2e06 |
|
BLAKE2b-256 | ec2e6dcc9677c67a34c17ffe5c7371e5ea15378db9e1881ca704a9af4a4ec4c9 |
File details
Details for the file domovoi-0.0.6-py2.py3-none-any.whl
.
File metadata
- Download URL: domovoi-0.0.6-py2.py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0dce89ce08247c279fce312ca7116eca430b33b0b6b57c7e5126362856a03adc |
|
MD5 | d8115844d2e8be12cb7a8d570e0f0bb9 |
|
BLAKE2b-256 | 222fa0359f8005d955809cddc5ab5803ca54136ad16027e880b90593c985f818 |