cron expression in AWS CloudWatch: How to run once a week

mxro picture mxro · Jul 7, 2016 · Viewed 15.6k times · Source

In Amazon AWS CloudWatch it is possible to run a rule according to a schedule that is defined in a cron expression.

The rules for this are outlined here.

After some trying around, I wasn't able to compose an expression that will run once a week (e.g. at 4 pm on Sunday). The following attempts were rejected by CloudWatch with the message Parameter ScheduleExpression is not valid...

0 16 * * SUN *
0 16 * * 6 *
0 16 * * SUN-SUN *
0 16 * * 6-6 *

Answer

Conti picture Conti · Jul 7, 2016

Try 0 16 ? * 1 * The question marks "says" that it must no be executed everyday, so it must check the week day value.