Is there any documentation related to how to set u...
# help
c
Is there any documentation related to how to set up different schedules to the same lambda function? I have a lambda that I want to run daily, weekly and monthly, using the same code but passing different params to it by the schedule rule. On Serverless framework I would pass the parameters to the
input
, something like:
Copy code
myLambda:
  handler: src/lambdas.main
  timeout: 30
  events:
    - schedule:
        rate: rate(1 day)
        input:
          frequency: "1 day"
    - schedule:
        rate: rate(1 week)
        input:
          frequency: "1 week"
    - schedule:
        rate: rate(1 month)
        input:
          frequency: "1 month"
it can be either a schedule or a cron job
s
yeah, you would basically define your
sst.Function
e.g.
const myFunc = new sst.Function(…)
and then each cron can reference that func.
Copy code
new sst.Cron(this, 'MyScheduler', {
  schedule: 'rate(30 minutes)',
  job: {
    function: myFunc
  },
});
c
great, thanks!