JAN
JAN

Reputation: 21865

Lambda function is not triggered using Cron

I have an event in AWS Serverless with the following YML :

service: change-status-to-insale
provider:
  name: aws
  runtime: nodejs12.x
functions:
  changeWeeklyStarterStatus:
    # Two Minutes : 0 */2 * ? * *   
    handler: handler.changeWeeklyStarterStatus
    schedule: cron(0 */2 * ? * *)
    enabled: true

I've uploaded using the command

serverless deploy

I've tried to invoke it every 2 minutes using the formula :

0 */2 * ? * *

However the event is not triggered.

I've tested it using the Test button and it runs the function perfectly.

But it's still not triggered.

Why ? What am I missing ?

Upvotes: 2

Views: 296

Answers (1)

Chetan Kumar
Chetan Kumar

Reputation: 1461

You have used wrong configuration for cron expression. use */2 * * * ? * for every 2 minute.

How to schedule from AWS Cloudwatch

enter image description here

Upvotes: 4

Related Questions