AnomalyMonitor class

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/v7/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
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_costexplorer_anomalymonitor" "service_monitor" {
  name              = "AWSServiceMonitor"
  monitor_type      = "DIMENSIONAL"
  monitor_dimension = "SERVICE"
}
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.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 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: null,
        CostCategories: null,
        Dimensions: null,
        Not: null,
        Or: null,
        Tags: {
            Key: "CostCenter",
            MatchOptions: null,
            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/v7/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
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_costexplorer_anomalymonitor" "test" {
  name         = "AWSCustomAnomalyMonitor"
  monitor_type = "CUSTOM"
  monitor_specification = jsonencode({
    "And"            = null
    "CostCategories" = null
    "Dimensions"     = null
    "Not"            = null
    "Or"             = null
    "Tags" = {
      "Key"          = "CostCenter"
      "MatchOptions" = null
      "Values"       = ["10000"]
    }
  })
}
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.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 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

Identity Schema

Required

  • arn (String) ARN of the Cost Explorer anomaly monitor.

Using pulumi import, import aws.costexplorer.AnomalyMonitor using the id. For example:

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

Constructors

AnomalyMonitor(String name, {AnomalyMonitorArgs? args, CustomResourceOptions? options})
Creates a new AnomalyMonitor. name The Pulumi resource name. args Arguments used to configure this AnomalyMonitor. The set of arguments for AnomalyMonitor. options Resource options controlling this resource's behavior.
AnomalyMonitor.reference(String urn)
Creates a typed reference to an existing AnomalyMonitor resource.

Properties

arn ↔ Output<String>
ARN of the anomaly monitor.
latefinal
childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
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
monitorDimension ↔ Output<String?>
The dimensions to evaluate. Valid values: COST_CATEGORY, LINKED_ACCOUNT, SERVICE, TAG.
latefinal
monitorSpecification ↔ Output<String?>
A valid JSON representation for the Expression object.
latefinal
monitorType ↔ Output<String>
The possible type values. Valid values: DIMENSIONAL | CUSTOM.
latefinal
name ↔ Output<String>
The name of the monitor.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
tags ↔ Output<Map<String, String>?>
A map of tags to assign to the resource. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
latefinal
tagsAll ↔ Output<Map<String, String>>
A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration 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, {AnomalyMonitorState? state, CustomResourceOptions? options}) → AnomalyMonitor
Gets an existing AnomalyMonitor resource's state with the given name and id.