Skip to content
v2.274.0

CronOptions Struct ​

Options to configure a cron expression.

All fields are strings so you can use complex expressions. Absence of a field implies '*' or '?', whichever one is appropriate.

Example ​

ts
import * as events from 'aws-cdk-lib/aws-events';
import * as targets from 'aws-cdk-lib/aws-events-targets';

declare const fn: lambda.Function;
const rule = new events.Rule(this, 'Schedule Rule', {
 schedule: events.Schedule.cron({ minute: '0', hour: '4' }),
});
rule.addTarget(new targets.LambdaFunction(fn));

Properties ​

daystringdaystrdayStringDaystringDay*string#
The day of the month to run this rule at.

Default: Every day of the month

hourstringhourstrhourStringHourstringHour*string#
The hour to run this rule at.

Default: Every hour

minutestringminutestrminuteStringMinutestringMinute*string#
The minute to run this rule at.

Default: Every minute

monthstringmonthstrmonthStringMonthstringMonth*string#
The month to run this rule at.

Default: Every month

weekDaystringweek_daystrweekDayStringWeekDaystringWeekDay*string#
The day of the week to run this rule at.

Default: Any day of the week

yearstringyearstryearStringYearstringYear*string#
The year to run this rule at.

Default: Every year