0

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?

2

3 Answers 3

2

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.

0

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

1
  • Sorry, my question was not so clear. please see changes I made.
    – A J
    Dec 1, 2018 at 13:17
0

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.

Lambda Function Scheduling

Multiple Cloudwatch Event Trigger

In this screenshot i have used rate expression but you are free to use cron.

1
  • can't you use just different events to customize however you want please make it more clear would you ?
    – varnit
    Dec 1, 2018 at 14:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.