We have already python lambda function running with AWS eventbridge which was configured manually using console to trigger lambda on 9 PM everyday. Currently, we also have rule arn for eventbridge.
Plan:
So, We are migrating everything to serverless framework to automate the whole lambda deployment and configuring eventbridge using serverless.yml to invoke the lambda on 9 pm.
Can anyone please advise how do I do that ?
Sample code:
functions:
myFunction:
handler: index.handler
events:
- eventBridge:
--------
--------
--------
There is documentation at serverless.com that describes this. All you do is add the cron schedule to the EventBridge event as if it was a schedule event. For example:
functions:
myFunction:
handler: index.handler
events:
- eventBridge:
schedule: cron(0 12 * * ? *)
input:
key1: value1
You can find the documentation for EventBridge here: https://www.serverless.com/framework/docs/providers/aws/events/event-bridge
And for the Schedule event with an example of a cron schedule here: https://www.serverless.com/framework/docs/providers/aws/events/schedule
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With