ScheduleExpression

class aws_cdk.aws_cloudwatch.ScheduleExpression

Bases: object

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.

See:

https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/alarm-mute-rules.html#defining-alarm-mute-rules

ExampleMetadata:

infused

Example:

# alarm1: cloudwatch.Alarm
# alarm2: cloudwatch.Alarm


alarm_mute_rule = cloudwatch.AlarmMuteRule(self, "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.
alarm_mute_rule.add_alarm(alarm2)

Attributes

expression_string

Retrieve the expression for this schedule.

time_zone

Retrieve the expression for this schedule.

Static Methods

classmethod at(date, time_zone=None)

Construct a one-time schedule from a date.

Parameters:
  • date (Union[CalendarDateTime, Dict[str, Any]]) – The date and time to use. The millisecond part will be ignored.

  • time_zone (Optional[TimeZone]) – The time zone to use for interpreting the date. Default: - UTC

Return type:

ScheduleExpression

classmethod cron(*, minute, day=None, hour=None, month=None, time_zone=None, week_day=None)

Create a recurring schedule from a set of cron fields and time zone.

Parameters:
  • minute (str) – The minute to run this rule at.

  • day (Optional[str]) – The day of the month to run this rule at. Default: - Every day of the month

  • hour (Optional[str]) – The hour to run this rule at. Default: - Every hour

  • month (Optional[str]) – The month to run this rule at. Default: - Every month

  • time_zone (Optional[TimeZone]) – The timezone to run the schedule in. Default: - TimeZone.ETC_UTC

  • week_day (Optional[str]) – The day of the week to run this rule at. Default: - Any day of the week

Return type:

ScheduleExpression

classmethod expression(expression, time_zone=None)

Construct a schedule from a literal schedule expression.

Parameters:
  • expression (str) – The expression to use. Must be in a format that CloudWatch will recognize

  • time_zone (Optional[TimeZone]) – The time zone to use for interpreting the expression. Default: - UTC

Return type:

ScheduleExpression