Menu
Amazon CloudWatch
Developer Guide (API Version 2010-08-01)

Schedule Expression Syntax 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.

Note

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 will be triggered within that minute but not on the precise 0th second.

CloudWatch Events supports the following formats:

  • cron(<Fields>)

  • rate(<Value> <Unit>)

Cron Expressions

Cron expressions have six required fields. Fields are separated by white space.

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

, - * /

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

Note

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

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.

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

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

FieldValues

Value

positive number

Unit

minute(s) OR hour(s) OR day(s)

Note

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.

The following examples show how to use rate expressions with the AWS CLI.

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