I am trying to trigger aws lambda function at different time each day.
For example:
- on Sunday @4 pm
- on Monday @10 pm
The next week
- on Sunday @6 pm
- on Monday @7 pm
etc..
For everyday there will be new time
Any suggestions?
I am trying to trigger aws lambda function at different time each day.
For example:
- on Sunday @4 pm
- on Monday @10 pm
The next week
- on Sunday @6 pm
- on Monday @7 pm
etc..
For everyday there will be new time
Any suggestions?
I figured it out using aws-sdk.
Here is how:
1- Create a Lambda function and give it access to CloudWatch Events and SWF.
2- Use putRule to add/update the rule with new cron expression every time this function is invoked.
3- After creating the rule, manually add this Lambda function as a target through the console.
It's not terribly intuitive, but you need to setup a CloudWatch Event as the trigger. CloudWatch Events can be setup to run at an interval (every 5 min) or on a traditional cron schedule. You can find a tutorial of how to do this with lambda here
Hello @Ahmed Aljasim welcome to stackoverflow with lambda function you can attach multiple cloudwatch event to execute lambda and use cron expression accordingly i'm also attaching screenshot for that and here is the link which is a good reference for scheduling a lambda function.
In this screenshot i have used rate expression but you are free to use cron.