Cron Expressions for AWS EventBridge and Lambda
AWS EventBridge (formerly CloudWatch Events) lets you schedule Lambda functions, Step Functions, ECS tasks, and other targets using either a rate expression or a cron expression. AWS cron syntax is similar to standard Unix cron but has some important differences that catch many developers off guard.
AWS cron syntax — 6 fields
AWS EventBridge uses 6 fields, not 5:
cron(minute hour day-of-month month day-of-week year)
↑ ↑ ↑ ↑ ↑ ↑
0-59 0-23 1-31 1-12 1-7 1970-2199Key difference from standard cron: AWS uses 1–7 for days (1=Sunday) instead of 0–6 (0=Sunday), and adds a year field.
The ? wildcard — day-of-month XOR day-of-week
AWS requires that exactly one of day-of-month and day-of-week be * or ?. If you specify a day-of-week, day-of-month must be ? and vice versa.
# Every Monday at 9 AM UTC cron(0 9 ? * 2 *) # day-of-month = ? because day-of-week is set # First of every month at midnight UTC cron(0 0 1 * ? *) # day-of-week = ? because day-of-month is set # Every day at 6 PM UTC cron(0 18 * * ? *) # use ? for day-of-week when not constrained
Practical examples
cron(0 12 * * ? *)— every day at noon UTCcron(0 2 ? * 2 *)— every Monday at 2 AM UTCcron(*/5 * * * ? *)— every 5 minutescron(0 8 1 * ? *)— first of every month at 8 AM UTCcron(0 9 ? * 2-6 *)— weekdays (Mon–Fri) at 9 AM UTCcron(0 0 ? 1,4,7,10 1 *)— first Sunday of Jan, Apr, Jul, Oct
Rate expressions — simpler for intervals
For simple interval schedules, AWS rate expressions are easier than cron:
rate(5 minutes) # every 5 minutes rate(1 hour) # every hour rate(7 days) # every 7 days # Note: singular for value=1 (rate(1 minute) not rate(1 minutes))
Scheduling in Terraform
resource "aws_cloudwatch_event_rule" "daily_job" {
name = "daily-lambda-trigger"
schedule_expression = "cron(0 9 ? * 2-6 *)" # weekdays 9 AM UTC
}
resource "aws_cloudwatch_event_target" "lambda_target" {
rule = aws_cloudwatch_event_rule.daily_job.name
arn = aws_lambda_function.my_function.arn
}Timezone handling
EventBridge cron always runs in UTC unless you use the newer EventBridge Scheduler (not CloudWatch Events), which supports specifying a timezone directly in the schedule. To run a Lambda at 9 AM IST (UTC+5:30), you would set the cron time to 3:30 UTC in standard EventBridge rules:
# 9:00 AM IST = 3:30 AM UTC cron(30 3 ? * 2-6 *)
Generate your cron expression
Use the Dev Brains AI Cron Generator to build your base cron expression from plain English, then adjust it to AWS format by adding the year field and using ? where required.