Skip to content
v2.274.0

ScheduleExpression Class ​

Schedule expression for CloudWatch alarm mute rule.

You can choose from three schedule types when configuring your schedule: cron-based and one-time schedules. Cron-based schedule is recurring schedule.

Example ​

ts
declare const alarm1: cloudwatch.Alarm;
declare const alarm2: cloudwatch.Alarm;

const alarmMuteRule = new cloudwatch.AlarmMuteRule(this, 'AlarmMuteRule', {
  alarms: [alarm1],
  // Defines the mute period begins at 0:00 everyday in UTC
  schedule: cloudwatch.ScheduleExpression.cron({ minute: '0', hour: '0' }),
  // Specifies the mute rule lasts 1 hour.
  duration: Duration.hours(1),
})

// The mute target can be added after construction.
alarmMuteRule.addAlarm(alarm2);

Initializer ​

ts
new ScheduleExpression()
python
ScheduleExpression()
java
new ScheduleExpression()
csharp
new ScheduleExpression()
go
NewScheduleExpression()

Properties ​

expressionStringstringexpression_stringstrexpressionStringStringExpressionStringstringExpressionString*string#
Retrieve the expression for this schedule.
timeZonemay be undefinedTimeZonetime_zonemay be undefinedTimeZonetimeZonemay be undefinedTimeZoneTimeZonemay be undefinedTimeZoneTimeZonemay be undefinedTimeZone#
Retrieve the expression for this schedule.

Methods ​

at(date: CalendarDateTime, timeZone?: TimeZone): ScheduleExpression // chainable@staticmethod def at(date: CalendarDateTime, time_zone: typing.Optional[TimeZone] = None) -> ScheduleExpressionpublic static ScheduleExpression at(CalendarDateTime date, TimeZone timeZone)public static ScheduleExpression At(CalendarDateTime date, TimeZone? timeZone = null)func At(Date CalendarDateTime, TimeZone TimeZone) ScheduleExpressionstatic#
Construct a one-time schedule from a date.
2 parameters

Parameters

  • datedatedatedateDate — The date and time to use.
  • timeZonetime_zonetimeZonetimeZoneTimeZone — The time zone to use for interpreting the date.
cron(options: CronOptions): ScheduleExpression // chainable@staticmethod def cron(options: CronOptions) -> ScheduleExpressionpublic static ScheduleExpression cron(CronOptions options)public static ScheduleExpression Cron(CronOptions options)func Cron(Options CronOptions) ScheduleExpressionstatic#
Create a recurring schedule from a set of cron fields and time zone.
expression(expression: string, timeZone?: TimeZone): ScheduleExpression // chainable@staticmethod def expression(expression: str, time_zone: typing.Optional[TimeZone] = None) -> ScheduleExpressionpublic static ScheduleExpression expression(String expression, TimeZone timeZone)public static ScheduleExpression Expression(string expression, TimeZone? timeZone = null)func Expression(Expression *string, TimeZone TimeZone) ScheduleExpressionstatic#
Construct a schedule from a literal schedule expression.
2 parameters

Parameters

  • expressionexpressionexpressionexpressionExpression — The expression to use.
  • timeZonetime_zonetimeZonetimeZoneTimeZone — The time zone to use for interpreting the expression.