Run an AWS EventBridge schedule twice a day
The AWS EventBridge expression for “Twice a day” is cron(0 0/12 * * ? *). Below: config you can paste, the next run times, and what to watch out for. AWS EventBridge Scheduler takes cron() with six fields, minutes to year, in the time zone you set (UTC by default).
cron(0 0/12 * * ? *)Open in tool“On the hour, every 12 hours”
EventBridge Scheduler
aws scheduler create-schedule \
--name twice-a-day \
--schedule-expression "cron(0 0/12 * * ? *)" \
--schedule-expression-timezone "UTC" \
--flexible-time-window Mode=OFF \
--target '{"Arn":"arn:aws:lambda:REGION:ACCOUNT:function:my-job","RoleArn":"arn:aws:iam::ACCOUNT:role/scheduler-invoke"}'resource "aws_scheduler_schedule" "twice_a_day" {
name = "twice-a-day"
schedule_expression = "cron(0 0/12 * * ? *)"
schedule_expression_timezone = "UTC"
flexible_time_window {
mode = "OFF"
}
target {
arn = aws_lambda_function.job.arn
role_arn = aws_iam_role.scheduler.arn
}
}AWS EventBridge gotchas
FAQ
What is the AWS EventBridge cron expression for “Twice a day”?
cron(0 0/12 * * ? *). It reads: On the hour, every 12 hours
Which time zone does a AWS EventBridge schedule use?
EventBridge Scheduler takes --schedule-expression-timezone with an IANA name and defaults to UTC. Older EventBridge rules only run in UTC.
What is the difference between rate() and cron()?
rate(5 minutes) runs at a fixed interval from when the schedule starts; cron() runs at clock times. Use cron() when the minute matters.
EventBridge Scheduler or EventBridge rules?
AWS recommends EventBridge Scheduler for new schedules: it supports time zones and one-time schedules. Rules only run in UTC.