Skip to content
v2.278.0

TimeWindow Class ​

A time window during which EventBridge Scheduler invokes the schedule.

Example ​

ts
declare const target: targets.LambdaInvoke;

const schedule = new Schedule(this, 'Schedule', {
    schedule: ScheduleExpression.rate(Duration.hours(12)),
    target,
    timeWindow: TimeWindow.flexible(Duration.hours(10)),
});
python
# target: targets.LambdaInvoke


schedule = Schedule(self, "Schedule",
    schedule=ScheduleExpression.rate(Duration.hours(12)),
    target=target,
    time_window=TimeWindow.flexible(Duration.hours(10))
)
java
LambdaInvoke target;


Schedule schedule = Schedule.Builder.create(this, "Schedule")
        .schedule(ScheduleExpression.rate(Duration.hours(12)))
        .target(target)
        .timeWindow(TimeWindow.flexible(Duration.hours(10)))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
LambdaInvoke target;


var schedule = new Schedule(this, "Schedule", new ScheduleProps {
    Schedule = ScheduleExpression.Rate(Duration.Hours(12)),
    Target = target,
    TimeWindow = TimeWindow.Flexible(Duration.Hours(10))
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var target LambdaInvoke


schedule := awscdk.NewSchedule(this, jsii.String("Schedule"), &ScheduleProps{
	Schedule: awscdk.ScheduleExpression_Rate(awscdk.Duration_Hours(jsii.Number(12))),
	Target: Target,
	TimeWindow: awscdk.TimeWindow_Flexible(awscdk.Duration_*Hours(jsii.Number(10))),
})

Properties ​

maxWindowmay be undefinedDurationmax_windowmay be undefinedDurationmaxWindowmay be undefinedDurationMaxWindowmay be undefinedDurationMaxWindowmay be undefinedDuration #
The maximum time window during which the schedule can be invoked.

Default: no value

Must be between 1 to 1440 minutes.

modestringmodestrmodeStringModestringMode*string #
Determines whether the schedule is invoked within a flexible time window.

Methods ​

flexible(maxWindow: Duration): TimeWindow // chainable@staticmethod def flexible(max_window: Duration) -> TimeWindowpublic static TimeWindow flexible(Duration maxWindow)public static TimeWindow Flexible(Duration maxWindow)func Flexible(MaxWindow Duration) TimeWindow static #
TimeWindow is enabled.
off(): TimeWindow // chainable@staticmethod def off() -> TimeWindowpublic static TimeWindow off()public static TimeWindow Off()func Off() TimeWindow static #
TimeWindow is disabled.