How can I set cron every last monday on aws cloudwatch events?

Viewed 663

I want to set cron to my lambda function. I wish that fired 10:00 am on the last monday of every month.

cron(* * * * [something special words here] *)

I wish next fire schedule will like this.

2020-04-27 10:00:00 JST
2020-05-25 10:00:00 JST
2020-06-29 10:00:00 JST
2020-07-27 10:00:00 JST
2020-08-31 10:00:00 JST

How can I do that?

1 Answers

Cloudwatch's schedule expressions have a built-in wildcard for Last days.

The expression would be,

cron(0 10 ? * 2L *)

The L wildcard in the day-of-week field specifies the last day of the week. Here 2L means the last monday of the month, where 1-7 represent SUN-SAT.

Related