Skip to content
v2.273.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= Every day of the month#
The day of the month to run this rule at.
hourstringhourstrhourStringHourstringHour*string= Every hour#
The hour to run this rule at.
minutestringminutestrminuteStringMinutestringMinute*string= Every minute#
The minute to run this rule at.
monthstringmonthstrmonthStringMonthstringMonth*string= Every month#
The month to run this rule at.
weekDaystringweek_daystrweekDayStringWeekDaystringWeekDay*string= Any day of the week#
The day of the week to run this rule at.
yearstringyearstryearStringYearstringYear*string= Every year#
The year to run this rule at.