Menu
Amazon CloudWatch Events
User Guide

Schedule Expressions for Rules

You can create rules that self-trigger on schedule in CloudWatch Events using Cron or rate expressions. All scheduled events use UTC time zone and the minimum precision for schedules is 1 minute.

CloudWatch Events does not provide second-level precision in schedule expressions. The finest resolution using a Cron expression is a minute. Due to the distributed nature of the CloudWatch Events and the target services, the delay between the time the scheduled rule is triggered and the time the target service honors the execution of the target resource might be several seconds. Your scheduled rule is triggered within that minute, but not on the precise 0th second.

CloudWatch Events supports the following formats for schedule expressions.

Cron Expressions

Cron expressions have six required fields. Fields are separated by white space. For more information, see CRON expression.

Syntax

cron(fields)
FieldValuesWildcards

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

, - * /

Wildcards

  • The , (comma) wildcard includes additional values. In the Month field, JAN,FEB,MAR would include January, February, and March.

  • The - (dash) wildcard specifies ranges. In the Day field, 1-15 would include days 1 through 15 of the specified month.

  • The * (asterisk) wildcard includes all values in the field. In the Hours field, * would include every hour.

  • The / (forward slash) wildcard specifies increments. In the Minutes field, you could enter 1/10 to specify every tenth minute, starting from the first minute of the hour (for example, the 11th, 21st, and 31st minute, and so on).

  • The ? (question mark) wildcard specifies one or another. In the Day-of-month field you could enter 7 and if you didn't care what day of the week the 7th was, you could enter ? in the Day-of-week field.

  • The L wildcard in the Day-of-month or Day-of-week fields specifies the last day of the month or week.

  • The W wildcard in the Day-of-month field specifies a weekday. In the Day-of-month field, 3W specifies the day closest to the third weekday of the month.

Limits

  • You can't specify the Day-of-month and Day-of-week fields in the same Cron expression. If you specify a value in one of the fields, you must use a ? (question mark) in the other.

  • Cron expressions that lead to rates faster than 1 minute are not supported. Support for specifying both a day-of-week and a day-of-month value is not complete (you must currently use the '?' character in one of these fields).

Examples

You can use the following sample cron strings when creating a rule with schedule.

MinutesHoursDay of monthMonthDay of weekYearMeaning

0

10

*

*

?

*

Run at 10:00 am (UTC) every day

15

12

*

*

?

*

Run at 12:15 pm (UTC) every day

0

18

?

*

MON-FRI

*

Run at 6:00 pm (UTC) every Monday through Friday

0

8

1

*

?

*

Run at 8:00 am (UTC) every 1st day of the month

0/15

*

*

*

?

*

Run every 15 minutes

0/10

*

?

*

MON-FRI

*

Run every 10 minutes Monday through Friday

0/5

8-17

?

*

MON-FRI

*

Run every 5 minutes Monday through Friday between 8:00 am and 5:55 pm (UTC)

The following examples show how to use Cron expressions with the AWS CLI put-rule command.

aws events put-rule --schedule-expression 'cron(0 12 * * ? *)' --name MyRule1
aws events put-rule --schedule-expression 'cron(15 10 ? * 6L 2002-2005)' --name MyRule2

Rate Expressions

A rate expression starts when you create the scheduled event rule, and then runs on its defined schedule.

Rate expressions have two required fields. Fields are separated by white space.

Syntax

rate(value unit)
value

A positive number.

unit

The unit of time.

Valid values: minute | minutes | hour | hours | day | days

Limits

If the value is equal to 1, then the unit must be singular. Similarly, for values greater than 1, the unit must be plural. For example, rate(1 hours) and rate(5 hour) are not valid, but rate(1 hour) and rate(5 hours) are valid.

Examples

The following examples show how to use rate expressions with the AWS CLI put-rule command.

aws events put-rule --schedule-expression 'rate(5 minutes)' --name MyRule3
aws events put-rule --schedule-expression 'rate(1 hour)' --name MyRule4
aws events put-rule --schedule-expression 'rate(1 day)' --name MyRule5