AnomalyMonitor

class AnomalyMonitor : KotlinCustomResource

Provides a CE Anomaly Monitor.

Example Usage

There are two main types of a Cost Anomaly Monitor: DIMENSIONAL and CUSTOM.

Dimensional Example

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const serviceMonitor = new aws.costexplorer.AnomalyMonitor("service_monitor", {
name: "AWSServiceMonitor",
monitorType: "DIMENSIONAL",
monitorDimension: "SERVICE",
});
import pulumi
import pulumi_aws as aws
service_monitor = aws.costexplorer.AnomalyMonitor("service_monitor",
name="AWSServiceMonitor",
monitor_type="DIMENSIONAL",
monitor_dimension="SERVICE")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var serviceMonitor = new Aws.CostExplorer.AnomalyMonitor("service_monitor", new()
{
Name = "AWSServiceMonitor",
MonitorType = "DIMENSIONAL",
MonitorDimension = "SERVICE",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/costexplorer"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := costexplorer.NewAnomalyMonitor(ctx, "service_monitor", &costexplorer.AnomalyMonitorArgs{
Name: pulumi.String("AWSServiceMonitor"),
MonitorType: pulumi.String("DIMENSIONAL"),
MonitorDimension: pulumi.String("SERVICE"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.costexplorer.AnomalyMonitor;
import com.pulumi.aws.costexplorer.AnomalyMonitorArgs;
import java.util.List;
import java.util.ArrayList;
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 serviceMonitor = new AnomalyMonitor("serviceMonitor", AnomalyMonitorArgs.builder()
.name("AWSServiceMonitor")
.monitorType("DIMENSIONAL")
.monitorDimension("SERVICE")
.build());
}
}
resources:
serviceMonitor:
type: aws:costexplorer:AnomalyMonitor
name: service_monitor
properties:
name: AWSServiceMonitor
monitorType: DIMENSIONAL
monitorDimension: SERVICE

Custom Example

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const test = new aws.costexplorer.AnomalyMonitor("test", {
name: "AWSCustomAnomalyMonitor",
monitorType: "CUSTOM",
monitorSpecification: JSON.stringify({
And: undefined,
CostCategories: undefined,
Dimensions: undefined,
Not: undefined,
Or: undefined,
Tags: {
Key: "CostCenter",
MatchOptions: undefined,
Values: ["10000"],
},
}),
});
import pulumi
import json
import pulumi_aws as aws
test = aws.costexplorer.AnomalyMonitor("test",
name="AWSCustomAnomalyMonitor",
monitor_type="CUSTOM",
monitor_specification=json.dumps({
"And": None,
"CostCategories": None,
"Dimensions": None,
"Not": None,
"Or": None,
"Tags": {
"Key": "CostCenter",
"MatchOptions": None,
"Values": ["10000"],
},
}))
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var test = new Aws.CostExplorer.AnomalyMonitor("test", new()
{
Name = "AWSCustomAnomalyMonitor",
MonitorType = "CUSTOM",
MonitorSpecification = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["And"] = null,
["CostCategories"] = null,
["Dimensions"] = null,
["Not"] = null,
["Or"] = null,
["Tags"] = new Dictionary<string, object?>
{
["Key"] = "CostCenter",
["MatchOptions"] = null,
["Values"] = new[]
{
"10000",
},
},
}),
});
});
package main
import (
"encoding/json"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/costexplorer"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
tmpJSON0, err := json.Marshal(map[string]interface{}{
"And": nil,
"CostCategories": nil,
"Dimensions": nil,
"Not": nil,
"Or": nil,
"Tags": map[string]interface{}{
"Key": "CostCenter",
"MatchOptions": nil,
"Values": []string{
"10000",
},
},
})
if err != nil {
return err
}
json0 := string(tmpJSON0)
_, err = costexplorer.NewAnomalyMonitor(ctx, "test", &costexplorer.AnomalyMonitorArgs{
Name: pulumi.String("AWSCustomAnomalyMonitor"),
MonitorType: pulumi.String("CUSTOM"),
MonitorSpecification: pulumi.String(json0),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.costexplorer.AnomalyMonitor;
import com.pulumi.aws.costexplorer.AnomalyMonitorArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import java.util.List;
import java.util.ArrayList;
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 test = new AnomalyMonitor("test", AnomalyMonitorArgs.builder()
.name("AWSCustomAnomalyMonitor")
.monitorType("CUSTOM")
.monitorSpecification(serializeJson(
jsonObject(
jsonProperty("And", null),
jsonProperty("CostCategories", null),
jsonProperty("Dimensions", null),
jsonProperty("Not", null),
jsonProperty("Or", null),
jsonProperty("Tags", jsonObject(
jsonProperty("Key", "CostCenter"),
jsonProperty("MatchOptions", null),
jsonProperty("Values", jsonArray("10000"))
))
)))
.build());
}
}
resources:
test:
type: aws:costexplorer:AnomalyMonitor
properties:
name: AWSCustomAnomalyMonitor
monitorType: CUSTOM
monitorSpecification:
fn::toJSON:
And: null
CostCategories: null
Dimensions: null
Not: null
Or: null
Tags:
Key: CostCenter
MatchOptions: null
Values:
- '10000'

Import

Using pulumi import, import aws_ce_anomaly_monitor using the id. For example:

$ pulumi import aws:costexplorer/anomalyMonitor:AnomalyMonitor example costAnomalyMonitorARN

Properties

Link copied to clipboard
val arn: Output<String>

ARN of the anomaly monitor.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val monitorDimension: Output<String>?

The dimensions to evaluate. Valid values: SERVICE.

Link copied to clipboard

A valid JSON representation for the Expression object.

Link copied to clipboard
val monitorType: Output<String>

The possible type values. Valid values: DIMENSIONAL | CUSTOM.

Link copied to clipboard
val name: Output<String>

The name of the monitor.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val tags: Output<Map<String, String>>?

A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Link copied to clipboard
val tagsAll: Output<Map<String, String>>

A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Link copied to clipboard
val urn: Output<String>