AWS Cron Expression Generator
AWS CloudWatch Events (now Amazon EventBridge) uses a 6-field cron format that differs from standard Linux cron. This guide covers the syntax for scheduling Lambda functions, ECS tasks, and other AWS resources.
AWS Cron Syntax (6 Fields)
minutes hours day-of-month month day-of-week year
| Field | Values | Special |
|---|---|---|
| Minutes | 0-59 | * , - / |
| Hours | 0-23 | * , - / |
| Day of Month | 1-31 | * , - / ? L W |
| Month | 1-12 or JAN-DEC | * , - / |
| Day of Week | 1-7 or SUN-SAT | * , - / ? L # |
| Year | 1970-2199 | * , - / |
Common AWS Cron Examples
| Schedule | AWS Expression | Standard Cron |
|---|---|---|
| Every 5 min | rate(5 minutes) | */5 * * * * |
| Every hour | 0 * * * ? * | 0 * * * * |
| Daily midnight | 0 0 * * ? * | 0 0 * * * |
| Weekdays 9 AM | 0 9 ? * MON-FRI * | 0 9 * * 1-5 |
| Monday noon | 0 12 ? * MON * | 0 12 * * 1 |
| 1st of month | 0 0 1 * ? * | 0 0 1 * * |
| Every 15 min | rate(15 minutes) | */15 * * * * |
| Every 2 hours | rate(2 hours) | 0 */2 * * * |
rate() vs cron()
rate() — Simple Intervals
Best for regular, repeating intervals:
rate(1 minute) rate(5 minutes) rate(1 hour) rate(1 day)
Singular for rate of 1 (minute), plural for rates > 1 (minutes).
cron() — Complex Schedules
Best for specific times, days, or patterns:
cron(0 9 ? * MON-FRI *) # Weekdays at 9 AM UTC cron(0 0 1 * ? *) # 1st of every month cron(0 */6 * * ? *) # Every 6 hours
AWS-Specific Rules
- UTC only: All cron expressions use UTC time. Convert manually for other timezones.
?required: Must use?in dom OR dow when the other is specified.- No shorthand:
@hourly,@dailynot supported. - Rate limits: Minimum 1 minute. Maximum 1 year.
Setting Up a CloudWatch Rule
Create a scheduled rule via AWS CLI:
aws events put-rule \ --name "DailyBackup" \ --schedule-expression "cron(0 2 * * ? *)" \ --state ENABLED
Add a Lambda target:
aws events put-targets \ --rule "DailyBackup" \ --targets "Id"="MyLambda","Arn"="arn:aws:lambda:us-east-1:123:function:backup"
FAQ
Why does AWS use ? instead of *?
To avoid ambiguity between dom and dow. If both are *, AWS can't determine whether to trigger on "every day" or "every weekday". ? in one field resolves this.
What timezone does AWS cron use?
UTC only. No built-in timezone support. Convert to UTC manually.
Can I mix rate() and cron()?
No. Each EventBridge rule uses either rate() or cron(). Create separate rules for different schedules. If you need both a simple interval and a specific time trigger for the same target resource, create two separate rules and attach the same target to both.
What happens if my cron expression triggers during a Daylight Saving Time change?
AWS cron expressions use UTC, which is not affected by Daylight Saving Time. However, if your target audience is in a timezone that observes DST, the local time of execution will shift by one hour during DST transitions. For example, a rule set to run at 9 AM UTC will run at 5 AM EST (UTC-4) during summer and 4 AM EST (UTC-5) during winter. Plan accordingly if the exact local time matters for your use case.