Menu
Amazon EC2 Systems Manager
User Guide

Cron Schedules for Systems Manager

When you create a Systems Manager Maintenance Window or an association using Systems Manager State Manager, you specify a schedule for when the window/association should run. You can specify a schedule in the form of either a time-based entry, called a cron expression, or a frequency-based entry, called a rate expression.

Example: This cron expression runs the Maintenance Window or the association at 4 PM (16:00) every Tuesday: cron(0 16 ? * TUE *)

In the AWS CLI, specify this expression using the --schedule parameter as follows:

Copy
--schedule "cron(0 16 ? * TUE *)"

Example:This rate expression runs the Maintenance Window or the association every other day: rate(2 days)

In the AWS CLI, specify this expression using the --schedule parameter as follows:

Copy
--schedule "rate(2 days)"

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

Minutes Hours Day of month Month Day of week Year Meaning
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 table shows more examples of cron expressions:

Cron Expression Example Runs At

0 0 2 ? 1/1 THU#3 *

02:00 AM the third Thursday of every month

0 15 10 ? * *

10:15 AM every day

0 0 0 21 1/1 ? *

midnight on the 21st of each month

0 15 10 ? * MON-FRI

10:15 AM every Monday, Tuesday, Wednesday, Thursday and Friday

0 0 2 L * ?

02:00 AM on the last day of every month

0 15 10 ? * 6L

10:15 AM on the last Friday of every month

The following table shows supported values for required cron entries:

Field Values Wildcards
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 , - * /

Note

You cannot specify a value in the Day-of-month and in the 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 field.

Wildcards

Cron expressions support the following 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.

Note

Cron expressions that lead to rates faster than 5 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.

For more information about cron expressions, see CRON expression at the Wikipedia website.

Rate Expressions

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

Field Values

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.