robskrob
robskrob

Reputation: 2918

Serverless Cron Syntax For Scheduled Lambda

How can I write the cron syntax to schedule a Lambda to run every ten minutes at the start of every hour? Here is what I've tried but keep running into errors:

users-cron:
  handler: functions/users.cron
  events:
    - schedule:
        rate: rate(10 minutes)
    - schedule:
        rate: cron(0-10 0-23 ? * MON-SUN *)

Upvotes: 2

Views: 1692

Answers (2)

robskrob
robskrob

Reputation: 2918

This is the exact syntax that answers my question:

users-cron:
  handler: functions/users.cron
  events:
    - schedule:
        rate: cron(0/10 0-23 ? * MON-SUN *)

Upvotes: 1

Zanon
Zanon

Reputation: 30800

Form docs, there is a very similar example:

Invoke a Lambda function every 10 min Mon-Fri
cron(0/10 * ? * MON-FRI *)

You could try:

users-cron:
  handler: functions/users.cron
  events:
    - schedule:
        rate: cron(0/10 * ? * * *)

Upvotes: 2

Related Questions