# 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.

- **Canonical URL**: https://opslint.dev/cron/aws-eventbridge-question-mark-wildcard-error/
- **Category**: `CRON`
- **Interactive Workbench**: [Open in Live Workbench](https://opslint.dev/cron/#expr=0%209%20%3F%20*%20MON-FRI%20*&tz=UTC&dialect=aws-eventbridge)
- **Normative Specifications**: `AWS EventBridge User Guide: Cron Expressions (6-Field Format)`, `AWS EventBridge Scheduler ScheduleExpression Reference`, `Quartz Scheduler CronTrigger ? Wildcard Heritage`

## Incident Symptom & Root Cause

**Production 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.

**Protocol / Engine Root Cause**: 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!

## Remediation Diff (Broken vs Verified Fix)

### Invalid Terraform EventBridge Cron (Two Traps!)

```text
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)"
}
```

### Valid 6-Field EventBridge Cron with ? and Named Weekdays

```text
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
  }
}
```

## Engineering 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

| Case / Engine | Protocol Behavior | Production Remediation |
| :--- | :--- | :--- |
| **Total field count** (`#eb-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** (`#eb-dom-dow-question-mark`) | cron(0 0 * * * *) fails ValidationException because both DOM and DOW are '*'. | Replace DOW '*' with '?': cron(0 0 * * ? *). |
| **Numeric weekday range (1-5)** (`#eb-weekday-numbering-shift`) | 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** (`#eb-nth-weekday-number`) | EventBridge supports native '#' operator in DOW when DOM is '?'. | Use cron(0 9 ? * 2#1 *) — remember 2 = Monday in EventBridge! |

## Frequently Asked Engineering Questions

### 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.

## Related Problem-Cluster Guides

- [AWS EventBridge Rules (UTC Only) vs EventBridge Scheduler (IANA Timezones)](https://opslint.dev/cron/aws-eventbridge-rules-utc-vs-scheduler-timezone/) — Why legacy CloudWatch / EventBridge Rules ignore local timezones and DST, and how to migrate to AWS EventBridge Scheduler with ScheduleExpressionTimezone.
- [The POSIX Cron Day-of-Month + Day-of-Week OR Trap (0 9 13 * 5 Runs Every Friday)](https://opslint.dev/cron/posix-dom-dow-or-boolean-trap/) — Why specifying both Day-of-Month and Day-of-Week in POSIX crontab evaluates as boolean OR (union) instead of AND, and how to guard intersection schedules.
- [Schedule the First Monday or Third Tuesday of Every Month in Portable Cron](https://opslint.dev/cron/nth-weekday-of-month-portable-cron-guard/) — How to run jobs on the Nth weekday of the month across POSIX crontab, GitHub Actions, Kubernetes CronJob, AWS EventBridge (#), and systemd timers.
- [Nearest Weekday Payroll Cron Schedules: 15W and LW vs Portable POSIX Guards](https://opslint.dev/cron/nearest-weekday-payroll-schedule-15w/) — Translate AWS EventBridge 15W and LW nearest-business-day payroll modifiers to POSIX crontab, Kubernetes CronJob, and GitHub Actions without month-crossing bugs.
