All Products
Search
Document Center

Elastic Compute Service:Cron expressions

Last Updated:May 15, 2026

Use cron expressions to schedule Cloud Assistant commands with flexible time-based triggers.

Basic syntax of cron expressions

A cron expression is a string of six or seven fields that defines a job schedule.

Format:

Seconds Minutes Hours Day-of-month Month Day-of-week [Year]
  • <Year> is optional.

  • For a single field:

    • Each field accepts specific values, ranges, increments, or special characters.

    • Separate multiple values with a comma (,).

    • Each field allows at most one leading zero. For example, 01 is valid but 001 is not.

See Valid values of fields and Examples for value ranges and special characters.

Valid values of fields

The following table lists the value range and special characters for each field.

Field

Required

Value range

Special characters

Seconds

Yes

[0, 59]

* , - /

Minutes

Yes

[0, 59]

* , - /

Hours

Yes

[0, 23]

* , - /

Date

Yes

[1, 31]

* , - / ? L W

Month

Yes

[1, 12] or [JAN, DEC]

* , - /

Day-of-week

Yes

[1, 7] or [MON, SUN]. In Cloud Assistant commands, if you use the [1, 7] format, 1 means Monday and 7 means Sunday.

Important

Cron expression semantics vary by system. Outside Cloud Assistant, 1 may indicate Sunday and 7 may indicate Saturday.

* , - / ? L #

Year

No

[Current year, 2099]

* , - /

Special characters

The following table describes each special character and its meaning.

Special character

Meaning

Example

*

All values.

In Month, * means every month.

,

A list of enumeration values.

In Minutes, 5,20 triggers at the 5th and 20th minute.

-

A range of values.

In Minutes, 5-20 triggers every minute from the 5th to the 20th.

/

An increment from a start value.

In Minutes, 0/15 starts at minute 0 and repeats every 15 minutes. 3/20 starts at minute 3 and repeats every 20 minutes.

?

Unspecified value. Used only in the Day-of-month and Day-of-week fields.

If you specify a value in either Day-of-month or Day-of-week, set the other to ? to avoid conflicts.

L

Last day. Supported only in the Day-of-month and Day-of-week fields.

Important

Do not combine L with lists or ranges. This may cause logical errors.

  • In Day-of-month, L means the last day of the month. In Day-of-week, L means Sunday (SUN).

  • A value before L, such as 6L in Day-of-week, means the last Saturday of the month.

W

Nearest weekday (Monday to Friday) to a specified day. Does not cross month boundaries. LW means the last weekday of the month.

In Day-of-month, 5W triggers on the nearest weekday to the 5th. If the 5th is a Saturday, it triggers on Friday the 4th. If the 5th is a Sunday, it triggers on Monday the 6th. If the 5th is a weekday, it triggers on the 5th.

#

The Nth occurrence of a weekday in the month.

Important

Supported only in the Day-of-week field.

In Day-of-week, 4#2 means the second Thursday of the month.

Examples

Scenario

Value

Run a task at a specific time daily.

Run the task at 10:15 daily.

0 15 10 ? * *

Run the task at 12:00 daily.

0 0 12 * * ?

Run a task at specific times daily.

Run the task at 10:00, 14:00, and 16:00 daily.

0 0 10,14,16 * * ?

Run a task at a fixed interval.

Run the task every 30 minutes from 09:00 to 17:00 daily.

0 0/30 9-17 * * ?

Run the task every minute from 14:00 to 14:59 daily.

0 * 14 * * ?

Run the task every minute from 14:00 to 14:05 daily.

0 0-5 14 * * ?

Run the task every 5 minutes from 14:00 to 14:55 daily.

0 0/5 14 * * ?

Run the task every 5 minutes from 14:00 to 14:55 and from 18:00 to 18:55 daily.

0 0/5 14,18 * * ?

Run a task on specific days of the month or week.

Run the task at 12:00 every Wednesday.

0 0 12 ? * WED

Run the task at 10:15 on the 15th day of every month.

0 15 10 15 * ?

Run the task at 10:15 on the last day of every month.

0 15 10 L * ?

Run the task at 10:15 on the last Saturday of every month.

0 15 10 ? * 6L

Run the task at 10:15 on the 3rd Saturday of every month.

0 15 10 ? * 6#3

Run a task on specific days in specific years.

Run the task at 14:10 and 14:44 every Wednesday in March every year.

0 10,44 14 ? 3 WED

Run the task at 10:15 daily in 2022.

0 15 10 ? * * 2022

Run the task at 10:15 daily, every year.

0 15 10 ? * * *

Run the task every 5 minutes from 14:00 to 14:55 and from 18:00 to 18:55 daily in 2022.

0 0/5 14,18 * * ? 2022

Run the task at 10:15 on the 3rd Saturday of every month in 2022 and 2023.

0 15 10 ? * 6#3 2022,2023

Run the task every 30 minutes from 9:00 to 17:30 daily from 2022 to 2025.

0 0/30 9-17 * * ? 2022-2025

Run the task at 14:10 and 14:44 every Wednesday in March every 2 years starting from 2022.

0 10,44 14 ? 3 WED 2022/2