Chalice AWS Eventbridge

552 views Asked by At

How do i create handler functions (lambdas) that trigger on custom events in a EventBridge event when using AWS Chalice ?

https://aws.github.io/chalice/index.html

Docs say they support Cloudwatch events. AWS docs say cloudwatch events is kinda the same as eventbridge.

https://aws.github.io/chalice/topics/events.html?highlight=cloudwatch#cloudwatch-events

But how do i create a handler for events in my eventbus ?

1

There are 1 answers

1
Joelster On

Not sure if you have custom events or scheduled events. If scheduled events then @me2resh provided the following samples on his great website: https://www.me2resh.com/posts/2020/05/05/aws-chalice-event-triggers.html

app = chalice.Chalice(app_name='chalice-scheduled-event-demo')

@app.schedule('cron(15 10 ? * 6L 2002-2005)')
def cron_handler(event):
    pass

@app.schedule('rate(5 minutes)')
def rate_handler(event):
    pass

@app.schedule(Rate(5, unit=Rate.MINUTES))
def rate_obj_handler(event):
    pass

@app.schedule(Cron(15, 10, '?', '*', '6L', '2002-2005'))
def cron_obj_handler(event):
    pass