1. Packages
  2. AWS
  3. API Docs
  4. costexplorer
  5. AnomalyMonitor
AWS v6.77.0 published on Wednesday, Apr 9, 2025 by Pulumi

aws.costexplorer.AnomalyMonitor

Explore with Pulumi AI

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",
});
Copy
import pulumi
import pulumi_aws as aws

service_monitor = aws.costexplorer.AnomalyMonitor("service_monitor",
    name="AWSServiceMonitor",
    monitor_type="DIMENSIONAL",
    monitor_dimension="SERVICE")
Copy
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
	})
}
Copy
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",
    });

});
Copy
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());

    }
}
Copy
resources:
  serviceMonitor:
    type: aws:costexplorer:AnomalyMonitor
    name: service_monitor
    properties:
      name: AWSServiceMonitor
      monitorType: DIMENSIONAL
      monitorDimension: SERVICE
Copy

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: null,
        CostCategories: null,
        Dimensions: null,
        Not: null,
        Or: null,
        Tags: {
            Key: "CostCenter",
            MatchOptions: null,
            Values: ["10000"],
        },
    }),
});
Copy
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"],
        },
    }))
Copy
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
	})
}
Copy
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",
                },
            },
        }),
    });

});
Copy
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());

    }
}
Copy
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'
Copy

Create AnomalyMonitor Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new AnomalyMonitor(name: string, args: AnomalyMonitorArgs, opts?: CustomResourceOptions);
@overload
def AnomalyMonitor(resource_name: str,
                   args: AnomalyMonitorArgs,
                   opts: Optional[ResourceOptions] = None)

@overload
def AnomalyMonitor(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   monitor_type: Optional[str] = None,
                   monitor_dimension: Optional[str] = None,
                   monitor_specification: Optional[str] = None,
                   name: Optional[str] = None,
                   tags: Optional[Mapping[str, str]] = None)
func NewAnomalyMonitor(ctx *Context, name string, args AnomalyMonitorArgs, opts ...ResourceOption) (*AnomalyMonitor, error)
public AnomalyMonitor(string name, AnomalyMonitorArgs args, CustomResourceOptions? opts = null)
public AnomalyMonitor(String name, AnomalyMonitorArgs args)
public AnomalyMonitor(String name, AnomalyMonitorArgs args, CustomResourceOptions options)
type: aws:costexplorer:AnomalyMonitor
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. AnomalyMonitorArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. AnomalyMonitorArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. AnomalyMonitorArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. AnomalyMonitorArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. AnomalyMonitorArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var anomalyMonitorResource = new Aws.CostExplorer.AnomalyMonitor("anomalyMonitorResource", new()
{
    MonitorType = "string",
    MonitorDimension = "string",
    MonitorSpecification = "string",
    Name = "string",
    Tags = 
    {
        { "string", "string" },
    },
});
Copy
example, err := costexplorer.NewAnomalyMonitor(ctx, "anomalyMonitorResource", &costexplorer.AnomalyMonitorArgs{
	MonitorType:          pulumi.String("string"),
	MonitorDimension:     pulumi.String("string"),
	MonitorSpecification: pulumi.String("string"),
	Name:                 pulumi.String("string"),
	Tags: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
})
Copy
var anomalyMonitorResource = new AnomalyMonitor("anomalyMonitorResource", AnomalyMonitorArgs.builder()
    .monitorType("string")
    .monitorDimension("string")
    .monitorSpecification("string")
    .name("string")
    .tags(Map.of("string", "string"))
    .build());
Copy
anomaly_monitor_resource = aws.costexplorer.AnomalyMonitor("anomalyMonitorResource",
    monitor_type="string",
    monitor_dimension="string",
    monitor_specification="string",
    name="string",
    tags={
        "string": "string",
    })
Copy
const anomalyMonitorResource = new aws.costexplorer.AnomalyMonitor("anomalyMonitorResource", {
    monitorType: "string",
    monitorDimension: "string",
    monitorSpecification: "string",
    name: "string",
    tags: {
        string: "string",
    },
});
Copy
type: aws:costexplorer:AnomalyMonitor
properties:
    monitorDimension: string
    monitorSpecification: string
    monitorType: string
    name: string
    tags:
        string: string
Copy

AnomalyMonitor Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The AnomalyMonitor resource accepts the following input properties:

MonitorType
This property is required.
Changes to this property will trigger replacement.
string
The possible type values. Valid values: DIMENSIONAL | CUSTOM.
MonitorDimension Changes to this property will trigger replacement. string
The dimensions to evaluate. Valid values: SERVICE.
MonitorSpecification Changes to this property will trigger replacement. string
A valid JSON representation for the Expression object.
Name string
The name of the monitor.
Tags Dictionary<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.
MonitorType
This property is required.
Changes to this property will trigger replacement.
string
The possible type values. Valid values: DIMENSIONAL | CUSTOM.
MonitorDimension Changes to this property will trigger replacement. string
The dimensions to evaluate. Valid values: SERVICE.
MonitorSpecification Changes to this property will trigger replacement. string
A valid JSON representation for the Expression object.
Name string
The name of the monitor.
Tags 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.
monitorType
This property is required.
Changes to this property will trigger replacement.
String
The possible type values. Valid values: DIMENSIONAL | CUSTOM.
monitorDimension Changes to this property will trigger replacement. String
The dimensions to evaluate. Valid values: SERVICE.
monitorSpecification Changes to this property will trigger replacement. String
A valid JSON representation for the Expression object.
name String
The name of the monitor.
tags 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.
monitorType
This property is required.
Changes to this property will trigger replacement.
string
The possible type values. Valid values: DIMENSIONAL | CUSTOM.
monitorDimension Changes to this property will trigger replacement. string
The dimensions to evaluate. Valid values: SERVICE.
monitorSpecification Changes to this property will trigger replacement. string
A valid JSON representation for the Expression object.
name string
The name of the monitor.
tags {[key: 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.
monitor_type
This property is required.
Changes to this property will trigger replacement.
str
The possible type values. Valid values: DIMENSIONAL | CUSTOM.
monitor_dimension Changes to this property will trigger replacement. str
The dimensions to evaluate. Valid values: SERVICE.
monitor_specification Changes to this property will trigger replacement. str
A valid JSON representation for the Expression object.
name str
The name of the monitor.
tags Mapping[str, str]
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.
monitorType
This property is required.
Changes to this property will trigger replacement.
String
The possible type values. Valid values: DIMENSIONAL | CUSTOM.
monitorDimension Changes to this property will trigger replacement. String
The dimensions to evaluate. Valid values: SERVICE.
monitorSpecification Changes to this property will trigger replacement. String
A valid JSON representation for the Expression object.
name String
The name of the monitor.
tags Map<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.

Outputs

All input properties are implicitly available as output properties. Additionally, the AnomalyMonitor resource produces the following output properties:

Arn string
ARN of the anomaly monitor.
Id string
The provider-assigned unique ID for this managed resource.
TagsAll Dictionary<string, string>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

Arn string
ARN of the anomaly monitor.
Id string
The provider-assigned unique ID for this managed resource.
TagsAll map[string]string
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn String
ARN of the anomaly monitor.
id String
The provider-assigned unique ID for this managed resource.
tagsAll Map<String,String>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn string
ARN of the anomaly monitor.
id string
The provider-assigned unique ID for this managed resource.
tagsAll {[key: string]: string}
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn str
ARN of the anomaly monitor.
id str
The provider-assigned unique ID for this managed resource.
tags_all Mapping[str, str]
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn String
ARN of the anomaly monitor.
id String
The provider-assigned unique ID for this managed resource.
tagsAll Map<String>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

Look up Existing AnomalyMonitor Resource

Get an existing AnomalyMonitor resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: AnomalyMonitorState, opts?: CustomResourceOptions): AnomalyMonitor
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        arn: Optional[str] = None,
        monitor_dimension: Optional[str] = None,
        monitor_specification: Optional[str] = None,
        monitor_type: Optional[str] = None,
        name: Optional[str] = None,
        tags: Optional[Mapping[str, str]] = None,
        tags_all: Optional[Mapping[str, str]] = None) -> AnomalyMonitor
func GetAnomalyMonitor(ctx *Context, name string, id IDInput, state *AnomalyMonitorState, opts ...ResourceOption) (*AnomalyMonitor, error)
public static AnomalyMonitor Get(string name, Input<string> id, AnomalyMonitorState? state, CustomResourceOptions? opts = null)
public static AnomalyMonitor get(String name, Output<String> id, AnomalyMonitorState state, CustomResourceOptions options)
resources:  _:    type: aws:costexplorer:AnomalyMonitor    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Arn string
ARN of the anomaly monitor.
MonitorDimension Changes to this property will trigger replacement. string
The dimensions to evaluate. Valid values: SERVICE.
MonitorSpecification Changes to this property will trigger replacement. string
A valid JSON representation for the Expression object.
MonitorType Changes to this property will trigger replacement. string
The possible type values. Valid values: DIMENSIONAL | CUSTOM.
Name string
The name of the monitor.
Tags Dictionary<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.
TagsAll Dictionary<string, string>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

Arn string
ARN of the anomaly monitor.
MonitorDimension Changes to this property will trigger replacement. string
The dimensions to evaluate. Valid values: SERVICE.
MonitorSpecification Changes to this property will trigger replacement. string
A valid JSON representation for the Expression object.
MonitorType Changes to this property will trigger replacement. string
The possible type values. Valid values: DIMENSIONAL | CUSTOM.
Name string
The name of the monitor.
Tags 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.
TagsAll map[string]string
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn String
ARN of the anomaly monitor.
monitorDimension Changes to this property will trigger replacement. String
The dimensions to evaluate. Valid values: SERVICE.
monitorSpecification Changes to this property will trigger replacement. String
A valid JSON representation for the Expression object.
monitorType Changes to this property will trigger replacement. String
The possible type values. Valid values: DIMENSIONAL | CUSTOM.
name String
The name of the monitor.
tags 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.
tagsAll Map<String,String>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn string
ARN of the anomaly monitor.
monitorDimension Changes to this property will trigger replacement. string
The dimensions to evaluate. Valid values: SERVICE.
monitorSpecification Changes to this property will trigger replacement. string
A valid JSON representation for the Expression object.
monitorType Changes to this property will trigger replacement. string
The possible type values. Valid values: DIMENSIONAL | CUSTOM.
name string
The name of the monitor.
tags {[key: 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.
tagsAll {[key: string]: string}
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn str
ARN of the anomaly monitor.
monitor_dimension Changes to this property will trigger replacement. str
The dimensions to evaluate. Valid values: SERVICE.
monitor_specification Changes to this property will trigger replacement. str
A valid JSON representation for the Expression object.
monitor_type Changes to this property will trigger replacement. str
The possible type values. Valid values: DIMENSIONAL | CUSTOM.
name str
The name of the monitor.
tags Mapping[str, str]
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.
tags_all Mapping[str, str]
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn String
ARN of the anomaly monitor.
monitorDimension Changes to this property will trigger replacement. String
The dimensions to evaluate. Valid values: SERVICE.
monitorSpecification Changes to this property will trigger replacement. String
A valid JSON representation for the Expression object.
monitorType Changes to this property will trigger replacement. String
The possible type values. Valid values: DIMENSIONAL | CUSTOM.
name String
The name of the monitor.
tags Map<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.
tagsAll Map<String>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

Import

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

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

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.