Skip to content

feat(cloudwatch): add L2 construct for AlarmMuteRule#37297

Open
kawaaaas wants to merge 5 commits intoaws:mainfrom
kawaaaas:feat/cloudwatch-alarm-mute-rule
Open

feat(cloudwatch): add L2 construct for AlarmMuteRule#37297
kawaaaas wants to merge 5 commits intoaws:mainfrom
kawaaaas:feat/cloudwatch-alarm-mute-rule

Conversation

@kawaaaas
Copy link
Copy Markdown

Issue # (if applicable)

N/A

Reason for this change

AWS CloudWatch recently introduced Alarm Mute Rules, which allow users to temporarily suppress alarm actions during predefined time windows (e.g., maintenance windows, deployments). The L1 construct CfnAlarmMuteRule is already available, but there is no L2 construct to provide a higher-level, CDK-idiomatic experience.

Description of changes

Added an L2 construct AlarmMuteRule for AWS::CloudWatch::AlarmMuteRule with the following

  • AlarmMuteRule class extending Resource, supporting creation and import (fromAlarmMuteRuleArn, fromAlarmMuteRuleName)
  • MuteSchedule class with cron(), at(), and expression() static methods for defining mute schedules
  • MuteDateTimeOptions interface for specifying start/expire dates with minute-level precision
  • addAlarm() method for adding mute targets after construction
  • Validation for duration bounds (1 minute to 15 days), date ordering, alarm count limits (max 100), and cron minute warning
  • Updated README.md with usage examples covering recurring mutes, one-time mutes, timezone, start/expire dates, and import
  • Exported from index.ts

Design decisions on date/time handling

  • MuteDateTimeOptions is a custom type with individual year, month, day, hour, minute fields instead of using Date or ISO 8601 strings. This is because the AlarmMuteRule API interprets dates in the timezone specified by the timezone property (defaulting to UTC), so using JavaScript Date objects (which are always UTC-based) would be misleading and error-prone. By using plain numeric fields, users specify the date/time exactly as it will be interpreted in the configured timezone.
  • The seconds component is intentionally omitted from the formatted output (yyyy-MM-ddTHH:mm) because the AlarmMuteRule API does not accept seconds and will reject requests that include them.

Describe any new or updated permissions being added

None

Description of how you validated changes

Add both unit and integ tests

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@github-actions github-actions bot added p2 beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK labels Mar 20, 2026
@aws-cdk-automation aws-cdk-automation requested a review from a team March 20, 2026 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK p2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant