How can I add CloudWatch schedule event rule for every quarter?

Viewed 629

I am trying to set a CloudWatch schedule event rule that will run on every quarter of year. But I am getting this error

"Parameter ScheduleExpression is not valid".

I tried following Cron expressions

cron(0 0 1 */3 * ?) 
cron(0 0 1 */3 ? *) 

But not working. Can anyone help in this?

1 Answers

Per AWS documentation

You cannot use * in both the Day-of-month and Day-of-week fields. If you use it in one, you must use ? in the other.

Also the year field does not support the ? wildcard, so your first expression is invalid.

The second one works:

aws events put-rule --schedule-expression "cron(0 0 1 */3 ? *)" --name so-test1
{
    "RuleArn": "arn:aws:events:eu-west-1:3333:rule/so-test1"
}

Do you have a space after the closing bracket? That one marked as invalid for me

aws events put-rule --schedule-expression "cron(0 0 1 */3 ? *) " --name so-test1

An error occurred (ValidationException) when calling the PutRule operation: Parameter ScheduleExpression is not valid.
Related