0
votes

I wanted to invoke my lambda in every minute during 13.00 and 17.00 UTC except for Tuesday. I wrote the following cron expression in cloudwatch rule, but I am getting error that

Parameter ScheduleExpression is not valid.

cron(0/1 13,14,15,16,17 * ? WED-MON *)

cron(* 13,14,15,16,17 * ? WED-MON *)

I cross checked the expression with crontab.guru also.

I even tried to do the following since I was still ok if it run in Tuesday.

cron(* 13,14,15,16,17 * * * *)

All of them are giving me error. Can somebody help me ?

1

1 Answers

0
votes

did you get a chance to refer this document: https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html?tag=duckduckgo-d-20#RateExpressions? Based on that your expression would look like: "0/1 13-17 ? * Wed-Mon *"

Let me know how it goes.

Edit: I accidentally used a "*" in place of a "?". I tried "0/1 13-17 ? * Wed-Mon *" and it worked.