Fix AWS EventBridge Cron ValidationException: The ? vs * Wildcard Rule
Resolve AWS EventBridge Parameter ScheduleExpression is not valid errors caused by 5-field POSIX syntax or using * in both Day-of-Month and Day-of-Week.
Incident Symptom & Protocol Root Cause
Production Failure Symptom
Deploying an AWS CloudFormation stack, Terraform aws_cloudwatch_event_rule, or aws_scheduler_schedule with cron(0 9 * * * *) or cron(0 9 * * 1-5) fails immediately with ValidationException: Parameter ScheduleExpression is not valid.
Scheduler Parser & Clock Mechanics
AWS EventBridge uses a 6-field Quartz-derived cron grammar (Minutes Hours Day-of-month Month Day-of-week Year) that strictly forbids specifying * (or concrete values) in BOTH Day-of-month and Day-of-week simultaneously—exactly one of the two fields MUST be set to ? ('no specific value'). Additionally, EventBridge numeric Day-of-week indexes 1=SUN..7=SAT, shifting every POSIX weekday number by one day!
Broken vs Verified Configuration
resource "aws_cloudwatch_event_rule" "weekday_report" {
name = "weekday-morning-report"
description = "Intended: Mon-Fri at 09:00 UTC"
# ERROR 1: Missing 6th field (Year) and '*' in both DOM and DOW -> ValidationException!
# ERROR 2: Even with '?', numeric 1-5 in EventBridge means SUN-THU, NOT MON-FRI!
schedule_expression = "cron(0 9 * * 1-5)"
}resource "aws_scheduler_schedule" "weekday_report" {
name = "weekday-morning-report"
group_name = "default"
# Valid 6-field format: cron(Minutes Hours DOM Month DOW Year)
# '?' in DOM + explicit MON-FRI prevents numeric 1=SUN vs 1=MON off-by-one bugs!
schedule_expression = "cron(0 9 ? * MON-FRI *)"
schedule_expression_timezone = "America/New_York"
flexible_time_window {
mode = "OFF"
}
target {
arn = aws_lambda_function.report.arn
role_arn = aws_iam_role.scheduler_invoke.arn
}
}Operational Deep Dive
Migrating POSIX crontabs to AWS EventBridge fails for two distinct reasons: structural validation and silent off-by-one weekday indexing. Structurally, EventBridge requires 6 space-separated fields wrapped in cron(...): Minutes (0-59), Hours (0-23), Day-of-month (1-31), Month (1-12 or JAN-DEC), Day-of-week (1-7 or SUN-SAT), and Year (1970-2199). Whenever Day-of-month uses * or a number, Day-of-week MUST be ?; whenever Day-of-week uses MON-FRI or 2#1, Day-of-month MUST be ?.
The second trap is far stealthier because Terraform and CloudFormation accept it without error: numeric Day-of-week numbering! In POSIX crontab, GitHub Actions, and Kubernetes, 0=Sunday, 1=Monday, and 5=Friday (so 1-5 means Monday through Friday). In AWS EventBridge, 1=Sunday, 2=Monday, and 6=Friday—so cron(0 9 ? * 1-5 *) passes AWS validation and runs Sunday through Thursday, skipping Friday!
Always write three-letter uppercase English abbreviations (SUN, MON, TUE, WED, THU, FRI, SAT and JAN-DEC) in AWS EventBridge expressions whenever referencing weekdays, except when using the # Nth-weekday operator where EventBridge requires numbers (for example 2#1 for the first Monday of the month, since 2=Monday).
POSIX 5-Field vs AWS EventBridge 6-Field Syntax Differences
| Engine / Case | Runtime Behavior | Production Remediation |
|---|---|---|
| Total field count | POSIX requires 5 fields (min hr dom mon dow); EventBridge requires 6 fields (+ Year). | Append * for the Year field and wrap inside cron(...). |
| Every day at midnight | cron(0 0 * * * *) fails ValidationException because both DOM and DOW are '*'. | Replace DOW '*' with '?': cron(0 0 * * ? *). |
| Numeric weekday range (1-5) | POSIX 1-5 = Mon–Fri; EventBridge 1-5 = Sun–Thu (1=SUN, 7=SAT)! | Always write named weekdays MON-FRI (or 2-6 if numeric is unavoidable). |
| First Monday of month | EventBridge supports native '#' operator in DOW when DOM is '?'. | Use cron(0 9 ? * 2#1 *) — remember 2 = Monday in EventBridge! |
Edge Cases & Engineering FAQs
Can I use MON#1 instead of 2#1 in AWS EventBridge?
EventBridge documentation specifies numeric day-of-week values (1-7, where 1=Sunday and 2=Monday) with the # operator (such as 2#1 for first Monday or 6#3 for third Friday). Stick to numeric 1-7#1-5 for Nth-weekday rules and test in the workbench.
How do I express a POSIX DOM+DOW union (13th OR Friday) in EventBridge if one field must be '?'?
Because EventBridge forbids non-'?' values in both DOM and DOW simultaneously, express a genuine union as two separate EventBridge schedules pointing to the same target: cron(0 9 13 * ? *) and cron(0 9 ? * FRI *).
Does AWS EventBridge support step values like */15 in minutes?
Yes, 0/15 (and */15 in EventBridge Scheduler) is supported in the Minutes and Hours fields, starting at minute 0 and firing at 0, 15, 30, and 45.
Runtime Dead-Man's-Switch Verification
Dead-man's-switch heartbeat checks that page on-call when a scheduled job skips a DST gap, stalls on a lock, or exits non-zero.