AlarmMuteRule class
Manages an AWS CloudWatch Alarm Mute Rule.
Example Usage
Basic Usage with Cron Expression
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.cloudwatch.AlarmMuteRule("example", {
rule: {
schedule: {
duration: "PT4H",
expression: "cron(0 2 * * *)",
},
},
name: "example",
});
import pulumi
import pulumi_aws as aws
example = aws.cloudwatch.AlarmMuteRule("example",
rule={
"schedule": {
"duration": "PT4H",
"expression": "cron(0 2 * * *)",
},
},
name="example")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.CloudWatch.AlarmMuteRule("example", new()
{
Rule = new Aws.CloudWatch.Inputs.AlarmMuteRuleRuleArgs
{
Schedule = new Aws.CloudWatch.Inputs.AlarmMuteRuleRuleScheduleArgs
{
Duration = "PT4H",
Expression = "cron(0 2 * * *)",
},
},
Name = "example",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/cloudwatch"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := cloudwatch.NewAlarmMuteRule(ctx, "example", &cloudwatch.AlarmMuteRuleArgs{
Rule: &cloudwatch.AlarmMuteRuleRuleArgs{
Schedule: &cloudwatch.AlarmMuteRuleRuleScheduleArgs{
Duration: pulumi.String("PT4H"),
Expression: pulumi.String("cron(0 2 * * *)"),
},
},
Name: pulumi.String("example"),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_cloudwatch_alarmmuterule" "example" {
rule = {
schedule = {
duration = "PT4H"
expression = "cron(0 2 * * *)"
}
}
name = "example"
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.cloudwatch.AlarmMuteRule;
import com.pulumi.aws.cloudwatch.AlarmMuteRuleArgs;
import com.pulumi.aws.cloudwatch.inputs.AlarmMuteRuleRuleArgs;
import com.pulumi.aws.cloudwatch.inputs.AlarmMuteRuleRuleScheduleArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new AlarmMuteRule("example", AlarmMuteRuleArgs.builder()
.rule(AlarmMuteRuleRuleArgs.builder()
.schedule(AlarmMuteRuleRuleScheduleArgs.builder()
.duration("PT4H")
.expression("cron(0 2 * * *)")
.build())
.build())
.name("example")
.build());
}
}
resources:
example:
type: aws:cloudwatch:AlarmMuteRule
properties:
rule:
schedule:
duration: PT4H
expression: cron(0 2 * * *)
name: example
With Start/Expire Dates Option
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.cloudwatch.MetricAlarm("example", {
name: "example",
comparisonOperator: "GreaterThanThreshold",
evaluationPeriods: 2,
metricName: "CPUUtilization",
namespace: "AWS/EC2",
period: 120,
statistic: "Average",
threshold: 80,
});
const exampleAlarmMuteRule = new aws.cloudwatch.AlarmMuteRule("example", {
rule: {
schedule: {
duration: "PT4H",
expression: "cron(0 2 * * *)",
timezone: "Asia/Tokyo",
},
},
muteTargets: {
alarmNames: [example.name],
},
name: "example",
description: "Mute alarms during maintenance window",
startDate: "2026-01-01T00:00:00Z",
expireDate: "2026-12-31T23:59:00Z",
tags: {
Environment: "production",
},
});
import pulumi
import pulumi_aws as aws
example = aws.cloudwatch.MetricAlarm("example",
name="example",
comparison_operator="GreaterThanThreshold",
evaluation_periods=2,
metric_name="CPUUtilization",
namespace="AWS/EC2",
period=120,
statistic="Average",
threshold=float(80))
example_alarm_mute_rule = aws.cloudwatch.AlarmMuteRule("example",
rule={
"schedule": {
"duration": "PT4H",
"expression": "cron(0 2 * * *)",
"timezone": "Asia/Tokyo",
},
},
mute_targets={
"alarm_names": [example.name],
},
name="example",
description="Mute alarms during maintenance window",
start_date="2026-01-01T00:00:00Z",
expire_date="2026-12-31T23:59:00Z",
tags={
"Environment": "production",
})
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.CloudWatch.MetricAlarm("example", new()
{
Name = "example",
ComparisonOperator = "GreaterThanThreshold",
EvaluationPeriods = 2,
MetricName = "CPUUtilization",
Namespace = "AWS/EC2",
Period = 120,
Statistic = "Average",
Threshold = 80,
});
var exampleAlarmMuteRule = new Aws.CloudWatch.AlarmMuteRule("example", new()
{
Rule = new Aws.CloudWatch.Inputs.AlarmMuteRuleRuleArgs
{
Schedule = new Aws.CloudWatch.Inputs.AlarmMuteRuleRuleScheduleArgs
{
Duration = "PT4H",
Expression = "cron(0 2 * * *)",
Timezone = "Asia/Tokyo",
},
},
MuteTargets = new Aws.CloudWatch.Inputs.AlarmMuteRuleMuteTargetsArgs
{
AlarmNames = new[]
{
example.Name,
},
},
Name = "example",
Description = "Mute alarms during maintenance window",
StartDate = "2026-01-01T00:00:00Z",
ExpireDate = "2026-12-31T23:59:00Z",
Tags =
{
{ "Environment", "production" },
},
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/cloudwatch"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := cloudwatch.NewMetricAlarm(ctx, "example", &cloudwatch.MetricAlarmArgs{
Name: pulumi.String("example"),
ComparisonOperator: pulumi.String("GreaterThanThreshold"),
EvaluationPeriods: pulumi.Int(2),
MetricName: pulumi.String("CPUUtilization"),
Namespace: pulumi.String("AWS/EC2"),
Period: pulumi.Int(120),
Statistic: pulumi.String("Average"),
Threshold: pulumi.Float64(80),
})
if err != nil {
return err
}
_, err = cloudwatch.NewAlarmMuteRule(ctx, "example", &cloudwatch.AlarmMuteRuleArgs{
Rule: &cloudwatch.AlarmMuteRuleRuleArgs{
Schedule: &cloudwatch.AlarmMuteRuleRuleScheduleArgs{
Duration: pulumi.String("PT4H"),
Expression: pulumi.String("cron(0 2 * * *)"),
Timezone: pulumi.String("Asia/Tokyo"),
},
},
MuteTargets: &cloudwatch.AlarmMuteRuleMuteTargetsArgs{
AlarmNames: pulumi.StringArray{
example.Name,
},
},
Name: pulumi.String("example"),
Description: pulumi.String("Mute alarms during maintenance window"),
StartDate: pulumi.String("2026-01-01T00:00:00Z"),
ExpireDate: pulumi.String("2026-12-31T23:59:00Z"),
Tags: pulumi.StringMap{
"Environment": pulumi.String("production"),
},
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_cloudwatch_metricalarm" "example" {
name = "example"
comparison_operator = "GreaterThanThreshold"
evaluation_periods = 2
metric_name = "CPUUtilization"
namespace = "AWS/EC2"
period = 120
statistic = "Average"
threshold = 80
}
resource "aws_cloudwatch_alarmmuterule" "example" {
rule = {
schedule = {
duration = "PT4H"
expression = "cron(0 2 * * *)"
timezone = "Asia/Tokyo"
}
}
mute_targets = {
alarm_names = [aws_cloudwatch_metricalarm.example.name]
}
name = "example"
description = "Mute alarms during maintenance window"
start_date = "2026-01-01T00:00:00Z"
expire_date = "2026-12-31T23:59:00Z"
tags = {
"Environment" = "production"
}
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.cloudwatch.MetricAlarm;
import com.pulumi.aws.cloudwatch.MetricAlarmArgs;
import com.pulumi.aws.cloudwatch.AlarmMuteRule;
import com.pulumi.aws.cloudwatch.AlarmMuteRuleArgs;
import com.pulumi.aws.cloudwatch.inputs.AlarmMuteRuleRuleArgs;
import com.pulumi.aws.cloudwatch.inputs.AlarmMuteRuleRuleScheduleArgs;
import com.pulumi.aws.cloudwatch.inputs.AlarmMuteRuleMuteTargetsArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new MetricAlarm("example", MetricAlarmArgs.builder()
.name("example")
.comparisonOperator("GreaterThanThreshold")
.evaluationPeriods(2)
.metricName("CPUUtilization")
.namespace("AWS/EC2")
.period(120)
.statistic("Average")
.threshold(80.0)
.build());
var exampleAlarmMuteRule = new AlarmMuteRule("exampleAlarmMuteRule", AlarmMuteRuleArgs.builder()
.rule(AlarmMuteRuleRuleArgs.builder()
.schedule(AlarmMuteRuleRuleScheduleArgs.builder()
.duration("PT4H")
.expression("cron(0 2 * * *)")
.timezone("Asia/Tokyo")
.build())
.build())
.muteTargets(AlarmMuteRuleMuteTargetsArgs.builder()
.alarmNames(example.name())
.build())
.name("example")
.description("Mute alarms during maintenance window")
.startDate("2026-01-01T00:00:00Z")
.expireDate("2026-12-31T23:59:00Z")
.tags(Map.of("Environment", "production"))
.build());
}
}
resources:
example:
type: aws:cloudwatch:MetricAlarm
properties:
name: example
comparisonOperator: GreaterThanThreshold
evaluationPeriods: 2
metricName: CPUUtilization
namespace: AWS/EC2
period: 120
statistic: Average
threshold: 80
exampleAlarmMuteRule:
type: aws:cloudwatch:AlarmMuteRule
name: example
properties:
rule:
schedule:
duration: PT4H
expression: cron(0 2 * * *)
timezone: Asia/Tokyo
muteTargets:
alarmNames:
- ${example.name}
name: example
description: Mute alarms during maintenance window
startDate: 2026-01-01T00:00:00Z
expireDate: 2026-12-31T23:59:00Z
tags:
Environment: production
With At Expression
> NOTE: When using at() expressions, do not set startDate or expireDate. The CloudWatch API returns the error Can not set start or expire dates for At expressions.
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.cloudwatch.AlarmMuteRule("example", {
rule: {
schedule: {
duration: "PT4H",
expression: "at(2026-12-31T23:59:59)",
},
},
name: "example",
});
import pulumi
import pulumi_aws as aws
example = aws.cloudwatch.AlarmMuteRule("example",
rule={
"schedule": {
"duration": "PT4H",
"expression": "at(2026-12-31T23:59:59)",
},
},
name="example")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.CloudWatch.AlarmMuteRule("example", new()
{
Rule = new Aws.CloudWatch.Inputs.AlarmMuteRuleRuleArgs
{
Schedule = new Aws.CloudWatch.Inputs.AlarmMuteRuleRuleScheduleArgs
{
Duration = "PT4H",
Expression = "at(2026-12-31T23:59:59)",
},
},
Name = "example",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/cloudwatch"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := cloudwatch.NewAlarmMuteRule(ctx, "example", &cloudwatch.AlarmMuteRuleArgs{
Rule: &cloudwatch.AlarmMuteRuleRuleArgs{
Schedule: &cloudwatch.AlarmMuteRuleRuleScheduleArgs{
Duration: pulumi.String("PT4H"),
Expression: pulumi.String("at(2026-12-31T23:59:59)"),
},
},
Name: pulumi.String("example"),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_cloudwatch_alarmmuterule" "example" {
rule = {
schedule = {
duration = "PT4H"
expression = "at(2026-12-31T23:59:59)"
}
}
name = "example"
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.cloudwatch.AlarmMuteRule;
import com.pulumi.aws.cloudwatch.AlarmMuteRuleArgs;
import com.pulumi.aws.cloudwatch.inputs.AlarmMuteRuleRuleArgs;
import com.pulumi.aws.cloudwatch.inputs.AlarmMuteRuleRuleScheduleArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new AlarmMuteRule("example", AlarmMuteRuleArgs.builder()
.rule(AlarmMuteRuleRuleArgs.builder()
.schedule(AlarmMuteRuleRuleScheduleArgs.builder()
.duration("PT4H")
.expression("at(2026-12-31T23:59:59)")
.build())
.build())
.name("example")
.build());
}
}
resources:
example:
type: aws:cloudwatch:AlarmMuteRule
properties:
rule:
schedule:
duration: PT4H
expression: at(2026-12-31T23:59:59)
name: example
Import
Identity Schema
Required
name(String) Name of the CloudWatch Alarm Mute Rule.
Optional
accountId(String) AWS Account where this resource is managed.region(String) Region where this resource is managed.
Using pulumi import, import CloudWatch Alarm Mute Rule using the name. For example:
$ pulumi import aws:cloudwatch/alarmMuteRule:AlarmMuteRule example example
Constructors
- AlarmMuteRule(String name, {AlarmMuteRuleArgs? args, CustomResourceOptions? options})
-
Creates a new AlarmMuteRule.
nameThe Pulumi resource name.argsArguments used to configure this AlarmMuteRule. The set of arguments for AlarmMuteRule.optionsResource options controlling this resource's behavior. - AlarmMuteRule.reference(String urn)
- Creates a typed reference to an existing AlarmMuteRule resource.
Properties
-
arn
↔ Output<
String> -
ARN of the Alarm Mute Rule.
latefinal
-
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
-
description
↔ Output<
String?> -
Description of the alarm mute rule.
latefinal
-
expireDate
↔ Output<
String?> -
Date and time in RFC3339 format when the mute rule expires. Seconds must be set to
00(e.g.,2026-12-31T23:59:00Z). Must not be set when usingat()expressions.latefinal - hashCode → int
-
The hash code for this object.
no setterinherited
-
id
↔ Output<
String> -
getter/setter pairinherited
- isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
lastUpdatedTimestamp
↔ Output<
String> -
Timestamp of when the mute rule was last updated.
latefinal
-
muteTargets
↔ Output<
AlarmMuteRuleMuteTargets?> -
Alarms to mute. See
muteTargetsblock below for details.latefinal -
muteType
↔ Output<
String> -
Indicates whether the mute rule is one-time or recurring. Valid values are
ONE_TIMEorRECURRING. See Alarm mute rules for details.latefinal -
name
↔ Output<
String> -
Name of the alarm mute rule. Changing this forces a new resource.
latefinal
-
region
↔ Output<
String> -
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
-
rule
↔ Output<
AlarmMuteRuleRule?> -
Rule definition for the mute rule. See
ruleblock below for details.latefinal - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
startDate
↔ Output<
String?> -
Date and time in RFC3339 format when the mute rule becomes active. Seconds must be set to
00(e.g.,2026-01-01T00:00:00Z). Must not be set when usingat()expressions.latefinal -
status
↔ Output<
String> -
Current status of the mute rule. Valid values are
SCHEDULED,ACTIVE, orEXPIRED.latefinal -
Map of tags assigned to the resource. If configured with a provider
defaultTagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.latefinal -
Map of tags assigned to the resource, including those inherited from the provider
defaultTagsconfiguration block.latefinal -
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
urn
↔ Output<
String> -
latefinalinherited
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
get(
String name, Input< String> id, {AlarmMuteRuleState? state, CustomResourceOptions? options}) → AlarmMuteRule -
Gets an existing AlarmMuteRule resource's state with the given
nameandid.