class AlarmMuteRule (construct)
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.CloudWatch.AlarmMuteRule |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awscloudwatch#AlarmMuteRule |
Java | software.amazon.awscdk.services.cloudwatch.AlarmMuteRule |
Python | aws_cdk.aws_cloudwatch.AlarmMuteRule |
TypeScript (source) | aws-cdk-lib » aws_cloudwatch » AlarmMuteRule |
Implements
IConstruct, IDependable, IResource, IEnvironment, IAlarm, IAlarm
A CloudWatch Alarm Mute Rule.
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 AlarmMuteRule(scope: Construct, id: string, props: AlarmMuteRuleProps)
Parameters
- scope
Construct - id
string - props
AlarmMute Rule Props
Construct Props
| Name | Type | Description |
|---|---|---|
| duration | Duration | The length of time that alarms remain muted when the schedule activates. |
| schedule | Schedule | The schedule defines when alarms should be muted. |
| alarm | string | The name of the alarm mute rule. |
| alarms? | IAlarm[] | The list of alarms that this mute rule targets. |
| description? | string | A description of the alarm mute rule that helps you identify its purpose. |
| expire? | Calendar | The date and time when the mute rule expires and is no longer evaluated. |
| start? | Calendar | The date and time after which the mute rule takes effect. |
| tags? | { [string]: string } | A list of tags associated with the alarm mute rule. |
duration
Type:
Duration
The length of time that alarms remain muted when the schedule activates.
Minimum: 1 minute, Maximum: 15 days
schedule
Type:
Schedule
The schedule defines when alarms should be muted.
alarmMuteRuleName?
Type:
string
(optional, default: generated by CloudFormation)
The name of the alarm mute rule.
This name must be unique within your AWS account and region.
alarms?
Type:
IAlarm[]
(optional, default: no target alarms)
The list of alarms that this mute rule targets.
You can specify up to 100 alarms.
description?
Type:
string
(optional, default: no description)
A description of the alarm mute rule that helps you identify its purpose.
expire?
Type:
Calendar
(optional, default: no configuration)
The date and time when the mute rule expires and is no longer evaluated.
After this time, the rule status becomes EXPIRED and will no longer mute the targeted alarms.
This date and time is interpreted according to the schedule timezone, or UTC if no timezone is specified.
start?
Type:
Calendar
(optional, default: no configuration)
The date and time after which the mute rule takes effect.
If not specified, the mute rule takes effect immediately upon creation and the mutes are applied as per the schedule expression.
This date and time is interpreted according to the schedule timezone, or UTC if no timezone is specified.
tags?
Type:
{ [string]: string }
(optional, default: No tags are applied)
A list of tags associated with the alarm mute rule.
Tags help you organize and categorize your AWS resources.
Properties
| Name | Type | Description |
|---|---|---|
| alarm | string | ARN of this alarm mute rule. |
| alarm | string | Name of this alarm mute rule. |
| alarm | Alarm | A reference to a AlarmMuteRule resource. |
| env | Resource | The environment this resource belongs to. |
| node | Node | The tree node. |
| stack | Stack | The stack in which this resource is defined. |
| static PROPERTY_INJECTION_ID | string | Uniquely identifies this class. |
alarmMuteRuleArn
Type:
string
ARN of this alarm mute rule.
alarmMuteRuleName
Type:
string
Name of this alarm mute rule.
alarmMuteRuleRef
Type:
Alarm
A reference to a AlarmMuteRule resource.
env
Type:
Resource
The environment this resource belongs to.
For resources that are created and managed in a Stack (those created by
creating new class instances like new Role(), new Bucket(), etc.), this
is always the same as the environment of the stack they belong to.
For referenced resources (those obtained from referencing methods like
Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be
different than the stack they were imported into.
node
Type:
Node
The tree node.
stack
Type:
Stack
The stack in which this resource is defined.
static PROPERTY_INJECTION_ID
Type:
string
Uniquely identifies this class.
Methods
| Name | Description |
|---|---|
| add | Add a CloudWatch alarm to mute rule target alarms. |
| apply | Override the cross-stack reference strength for this resource. |
| apply | Apply the given removal policy to this resource. |
| to | Returns a string representation of this construct. |
| with(...mixins) | Applies one or more mixins to this construct. |
| static from | Import an existing CloudWatch alarm mute rule provided an ARN. |
| static from | Import an existing CloudWatch alarm mute rule provided an Name. |
addAlarm(alarm)
public addAlarm(alarm: IAlarmRef): void
Parameters
- alarm
IAlarmRef
Add a CloudWatch alarm to mute rule target alarms.
applyCrossStackReferenceStrength(strength)
public applyCrossStackReferenceStrength(strength: ReferenceStrength): void
Parameters
- strength
Reference— - The reference strength to use for this resource.Strength
Override the cross-stack reference strength for this resource.
When set, any cross-stack reference to this resource will use the specified
mechanism instead of the global default determined by the
@aws-cdk/core:defaultCrossStackReferences context key. This is useful for
selectively weakening specific references to avoid the "deadly embrace" problem
without changing the app-wide default.
applyRemovalPolicy(policy)
public applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
RemovalPolicy
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN).
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.
with(...mixins)
public with(...mixins: IMixin[]): IConstruct
Parameters
- mixins
IMixin
Returns
Applies one or more mixins to this construct.
Mixins are applied in order. The list of constructs is captured at the
start of the call, so constructs added by a mixin will not be visited.
Use multiple with() calls if subsequent mixins should apply to added
constructs.
static fromAlarmMuteRuleArn(scope, id, alarmMuteRuleArn)
public static fromAlarmMuteRuleArn(scope: Construct, id: string, alarmMuteRuleArn: string): IAlarmMuteRule
Parameters
- scope
Construct— The parent creating construct (usuallythis). - id
string— The construct's name. - alarmMuteRuleArn
string— Alarm Mute Rule ARN.
Returns
Import an existing CloudWatch alarm mute rule provided an ARN.
static fromAlarmMuteRuleName(scope, id, alarmMuteRuleName)
public static fromAlarmMuteRuleName(scope: Construct, id: string, alarmMuteRuleName: string): IAlarmMuteRule
Parameters
- scope
Construct— The parent creating construct (usuallythis). - id
string— The construct's name. - alarmMuteRuleName
string— Alarm Mute Rule Name.
Returns
Import an existing CloudWatch alarm mute rule provided an Name.

.NET
Go
Java
Python
TypeScript (