class ScheduleExpression
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.CloudWatch.ScheduleExpression |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awscloudwatch#ScheduleExpression |
Java | software.amazon.awscdk.services.cloudwatch.ScheduleExpression |
Python | aws_cdk.aws_cloudwatch.ScheduleExpression |
TypeScript (source) | aws-cdk-lib » aws_cloudwatch » ScheduleExpression |
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
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
new ScheduleExpression()
Properties
| Name | Type | Description |
|---|---|---|
| expression | string | Retrieve the expression for this schedule. |
| time | Time | Retrieve the expression for this schedule. |
expressionString
Type:
string
Retrieve the expression for this schedule.
timeZone?
Type:
Time
(optional)
Retrieve the expression for this schedule.
Methods
| Name | Description |
|---|---|
| static at(date, timeZone?) | Construct a one-time schedule from a date. |
| static cron(options) | Create a recurring schedule from a set of cron fields and time zone. |
| static expression(expression, timeZone?) | Construct a schedule from a literal schedule expression. |
static at(date, timeZone?)
public static at(date: CalendarDateTime, timeZone?: TimeZone): ScheduleExpression
Parameters
- date
Calendar— The date and time to use.Date Time - timeZone
Time— The time zone to use for interpreting the date.Zone
Returns
Construct a one-time schedule from a date.
static cron(options)
public static cron(options: CronOptions): ScheduleExpression
Parameters
- options
CronOptions
Returns
Create a recurring schedule from a set of cron fields and time zone.
static expression(expression, timeZone?)
public static expression(expression: string, timeZone?: TimeZone): ScheduleExpression
Parameters
- expression
string— The expression to use. - timeZone
Time— The time zone to use for interpreting the expression.Zone
Returns
Construct a schedule from a literal schedule expression.

.NET
Go
Java
Python
TypeScript (