Rate expression
1 |
rate(<em class="replaceable"><code class="">Value</code></em> <em class="replaceable"><code class=""><span class="">Unit</span></code></em>) |
Where:
Value
can be a positive integer.
Unit
can be minute(s), hour(s), or day(s).
For example:
Example | Cron expression | ||
---|---|---|---|
Invoke Lambda function every 5 minutes |
|
||
Invoke Lambda function every hour |
|
||
Invoke Lambda function every seven days |
|
Note the following:
- Rate frequencies of less than one minute are not supported.
- For a singular value the unit must be singular (for example,
rate(1 day)
), otherwise plural (for example,rate(5 days)
).
Cron expression
1 |
cron(<em class="replaceable"><code class="">Minutes</code></em> <em class="replaceable"><code class="">Hours</code></em> <em class="replaceable"><code class="">Day-<span class="">of</span>-month</code></em> <em class="replaceable"><code class="">Month</code></em> <em class="replaceable"><code class="">Day-<span class="">of</span>-week</code></em> <em class="replaceable"><code class="">Year</code></em>) |
All fields are required and time zone is UTC only. The following table describes these fields.
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 | , – * / |
The following table describes the wildcard characters.
/ – specifices increments, i.e. 0/15 in the minutes field directs execution to occur every 15 minutes, i.e. 5/10 means 5, 15, 25, 35, etc.
L – specifies “Last”; i.e. If used in Day-of-month field, specifies last day of the month. If used in Day-of-week field, specifies last day of the week (Saturday).
W – specifies “Weekday”; i.e. When used with a date, such as 5/W
, specifies the closest weekday to 5th day of the month. If the 5th falls on a Saturday, execution occurs on Friday. If the 5th falls on a Sunday, execution occurs on Monday.
# – specifies the day of the month; i.e. Specifying 3#2
means the second Tuesday of the month (Tuesday is the third day of the 7-day week).
* – specifies All Values; i.e. If used in the Day-of-month field, it means all days in the month.
? – no specified value; i.e. Used in conjunction with another specified value. For example, if a specific date is specified, but you don’t care what day of the week it falls on.
“-” – specifies ranges; i.e. 10-12 would mean 10, 11 and 12
‘ – specifies additional values; i.e. SUN, MON, TUE means Sunday, Monday and Tuesday
The following table lists common examples of cron expressions.
Example | Cron expression | ||
---|---|---|---|
Invoke a Lambda function at 10:00am (UTC) everyday |
|
||
Invoke a Lambda function 12:15pm (UTC) everyday |
|
||
Invoke a Lambda function at 06:00pm (UTC) every Mon-Fri |
|
||
Invoke a Lambda function at 8:00am (UTC) every first day of the month |
|
||
Invoke a Lambda function every 10 min Mon-Fri |
|
||
Invoke a Lambda function every 5 minutes Mon-Fri between 8:00am and 5:55pm (UTC) |
|
||
Invoke a Lambda function at 9 a.m. (UTC) the first Monday of each month |
|
Note the following:
- Cron expressions that lead to rates faster than one minute are not supported.
- One of the day-of-month or day-of-week values must be a question mark (
?
).