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?

A J
  • 31
  • 1
  • 5

3 Answers3

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.

A J
  • 31
  • 1
  • 5
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

Jarred Olson
  • 3,075
  • 1
  • 19
  • 34
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.

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