AWS Classic

Pulumi Official
Package maintained by Pulumi
v5.10.0 published on Monday, Jul 11, 2022 by Pulumi

AnomalySubscription

Provides a CE Anomaly Subscription.

Example Usage

Basic Example

Coming soon!

Coming soon!

package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var testAnomalyMonitor = new AnomalyMonitor("testAnomalyMonitor", AnomalyMonitorArgs.builder()        
            .type("DIMENSIONAL")
            .dimension("SERVICE")
            .build());

        var testAnomalySubscription = new AnomalySubscription("testAnomalySubscription", AnomalySubscriptionArgs.builder()        
            .threshold(100)
            .frequency("DAILY")
            .monitorArnLists(testAnomalyMonitor.arn())
            .subscribers(AnomalySubscriptionSubscriberArgs.builder()
                .type("EMAIL")
                .address("abc@example.com")
                .build())
            .build());

    }
}

Coming soon!

Coming soon!

resources:
  testAnomalyMonitor:
    type: aws:costexplorer:AnomalyMonitor
    properties:
      type: DIMENSIONAL
      dimension: SERVICE
  testAnomalySubscription:
    type: aws:costexplorer:AnomalySubscription
    properties:
      threshold: 100
      frequency: DAILY
      monitorArnLists:
        - ${testAnomalyMonitor.arn}
      subscribers:
        - type: EMAIL
          address: abc@example.com

SNS Example

Coming soon!

Coming soon!

package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;
import com.pulumi.resources.CustomResourceOptions;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var costAnomalyUpdates = new Topic("costAnomalyUpdates");

        final var snsTopicPolicy = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
            .policyId("__default_policy_ID")
            .statements(            
                GetPolicyDocumentStatementArgs.builder()
                    .sid("AWSAnomalyDetectionSNSPublishingPermissions")
                    .actions("SNS:Publish")
                    .effect("Allow")
                    .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
                        .type("Service")
                        .identifiers("costalerts.amazonaws.com")
                        .build())
                    .resources(costAnomalyUpdates.arn())
                    .build(),
                GetPolicyDocumentStatementArgs.builder()
                    .sid("__default_statement_ID")
                    .actions(                    
                        "SNS:Subscribe",
                        "SNS:SetTopicAttributes",
                        "SNS:RemovePermission",
                        "SNS:Receive",
                        "SNS:Publish",
                        "SNS:ListSubscriptionsByTopic",
                        "SNS:GetTopicAttributes",
                        "SNS:DeleteTopic",
                        "SNS:AddPermission")
                    .conditions(GetPolicyDocumentStatementConditionArgs.builder()
                        .test("StringEquals")
                        .variable("AWS:SourceOwner")
                        .values(var_.account-id())
                        .build())
                    .effect("Allow")
                    .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
                        .type("AWS")
                        .identifiers("*")
                        .build())
                    .resources(costAnomalyUpdates.arn())
                    .build())
            .build());

        var default_ = new TopicPolicy("default", TopicPolicyArgs.builder()        
            .arn(costAnomalyUpdates.arn())
            .policy(snsTopicPolicy.apply(getPolicyDocumentResult -> getPolicyDocumentResult).apply(snsTopicPolicy -> snsTopicPolicy.apply(getPolicyDocumentResult -> getPolicyDocumentResult.json())))
            .build());

        var anomalyMonitor = new AnomalyMonitor("anomalyMonitor", AnomalyMonitorArgs.builder()        
            .type("DIMENSIONAL")
            .dimension("SERVICE")
            .build());

        var realtimeSubscription = new AnomalySubscription("realtimeSubscription", AnomalySubscriptionArgs.builder()        
            .threshold(0)
            .frequency("IMMEDIATE")
            .monitorArnLists(anomalyMonitor.arn())
            .subscribers(AnomalySubscriptionSubscriberArgs.builder()
                .type("SNS")
                .address(costAnomalyUpdates.arn())
                .build())
            .build(), CustomResourceOptions.builder()
                .dependsOn(default_)
                .build());

    }
}

Coming soon!

Coming soon!

resources:
  costAnomalyUpdates:
    type: aws:sns:Topic
  default:
    type: aws:sns:TopicPolicy
    properties:
      arn: ${costAnomalyUpdates.arn}
      policy: ${snsTopicPolicy.json}
  anomalyMonitor:
    type: aws:costexplorer:AnomalyMonitor
    properties:
      type: DIMENSIONAL
      dimension: SERVICE
  realtimeSubscription:
    type: aws:costexplorer:AnomalySubscription
    properties:
      threshold: 0
      frequency: IMMEDIATE
      monitorArnLists:
        - ${anomalyMonitor.arn}
      subscribers:
        - type: SNS
          address: ${costAnomalyUpdates.arn}
    options:
      dependson:
        - ${default}
variables:
  snsTopicPolicy:
    Fn::Invoke:
      Function: aws:iam:getPolicyDocument
      Arguments:
        policyId: __default_policy_ID
        statements:
          - sid: AWSAnomalyDetectionSNSPublishingPermissions
            actions:
              - SNS:Publish
            effect: Allow
            principals:
              - type: Service
                identifiers:
                  - costalerts.amazonaws.com
            resources:
              - ${costAnomalyUpdates.arn}
          - sid: __default_statement_ID
            actions:
              - SNS:Subscribe
              - SNS:SetTopicAttributes
              - SNS:RemovePermission
              - SNS:Receive
              - SNS:Publish
              - SNS:ListSubscriptionsByTopic
              - SNS:GetTopicAttributes
              - SNS:DeleteTopic
              - SNS:AddPermission
            conditions:
              - test: StringEquals
                variable: AWS:SourceOwner
                values:
                  - ${var"account-id"[%!s(MISSING)]}
            effect: Allow
            principals:
              - type: AWS
                identifiers:
                  - '*'
            resources:
              - ${costAnomalyUpdates.arn}

Create a AnomalySubscription Resource

new AnomalySubscription(name: string, args: AnomalySubscriptionArgs, opts?: CustomResourceOptions);
@overload
def AnomalySubscription(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        account_id: Optional[str] = None,
                        frequency: Optional[str] = None,
                        monitor_arn_lists: Optional[Sequence[str]] = None,
                        name: Optional[str] = None,
                        subscribers: Optional[Sequence[AnomalySubscriptionSubscriberArgs]] = None,
                        tags: Optional[Mapping[str, str]] = None,
                        tags_all: Optional[Mapping[str, str]] = None,
                        threshold: Optional[float] = None)
@overload
def AnomalySubscription(resource_name: str,
                        args: AnomalySubscriptionArgs,
                        opts: Optional[ResourceOptions] = None)
func NewAnomalySubscription(ctx *Context, name string, args AnomalySubscriptionArgs, opts ...ResourceOption) (*AnomalySubscription, error)
public AnomalySubscription(string name, AnomalySubscriptionArgs args, CustomResourceOptions? opts = null)
public AnomalySubscription(String name, AnomalySubscriptionArgs args)
public AnomalySubscription(String name, AnomalySubscriptionArgs args, CustomResourceOptions options)
type: aws:costexplorer:AnomalySubscription
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

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

AnomalySubscription Resource Properties

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

Inputs

The AnomalySubscription resource accepts the following input properties:

Frequency string

The frequency that anomaly reports are sent. Valid Values: DAILY | IMMEDIATE | WEEKLY.

MonitorArnLists List<string>

A list of cost anomaly monitors.

Subscribers List<AnomalySubscriptionSubscriberArgs>

A subscriber configuration. Multiple subscribers can be defined.

Threshold double

The dollar value that triggers a notification if the threshold is exceeded.

AccountId string

The unique identifier for the AWS account in which the anomaly subscription ought to be created.

Name string

The name for the subscription.

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.

Frequency string

The frequency that anomaly reports are sent. Valid Values: DAILY | IMMEDIATE | WEEKLY.

MonitorArnLists []string

A list of cost anomaly monitors.

Subscribers []AnomalySubscriptionSubscriberArgs

A subscriber configuration. Multiple subscribers can be defined.

Threshold float64

The dollar value that triggers a notification if the threshold is exceeded.

AccountId string

The unique identifier for the AWS account in which the anomaly subscription ought to be created.

Name string

The name for the subscription.

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.

frequency String

The frequency that anomaly reports are sent. Valid Values: DAILY | IMMEDIATE | WEEKLY.

monitorArnLists List<String>

A list of cost anomaly monitors.

subscribers List<AnomalySubscriptionSubscriberArgs>

A subscriber configuration. Multiple subscribers can be defined.

threshold Double

The dollar value that triggers a notification if the threshold is exceeded.

accountId String

The unique identifier for the AWS account in which the anomaly subscription ought to be created.

name String

The name for the subscription.

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.

frequency string

The frequency that anomaly reports are sent. Valid Values: DAILY | IMMEDIATE | WEEKLY.

monitorArnLists string[]

A list of cost anomaly monitors.

subscribers AnomalySubscriptionSubscriberArgs[]

A subscriber configuration. Multiple subscribers can be defined.

threshold number

The dollar value that triggers a notification if the threshold is exceeded.

accountId string

The unique identifier for the AWS account in which the anomaly subscription ought to be created.

name string

The name for the subscription.

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.

frequency str

The frequency that anomaly reports are sent. Valid Values: DAILY | IMMEDIATE | WEEKLY.

monitor_arn_lists Sequence[str]

A list of cost anomaly monitors.

subscribers Sequence[AnomalySubscriptionSubscriberArgs]

A subscriber configuration. Multiple subscribers can be defined.

threshold float

The dollar value that triggers a notification if the threshold is exceeded.

account_id str

The unique identifier for the AWS account in which the anomaly subscription ought to be created.

name str

The name for the subscription.

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.

frequency String

The frequency that anomaly reports are sent. Valid Values: DAILY | IMMEDIATE | WEEKLY.

monitorArnLists List<String>

A list of cost anomaly monitors.

subscribers List<Property Map>

A subscriber configuration. Multiple subscribers can be defined.

threshold Number

The dollar value that triggers a notification if the threshold is exceeded.

accountId String

The unique identifier for the AWS account in which the anomaly subscription ought to be created.

name String

The name for the subscription.

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.

Outputs

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

Arn string

ARN of the anomaly subscription.

Id string

The provider-assigned unique ID for this managed resource.

Arn string

ARN of the anomaly subscription.

Id string

The provider-assigned unique ID for this managed resource.

arn String

ARN of the anomaly subscription.

id String

The provider-assigned unique ID for this managed resource.

arn string

ARN of the anomaly subscription.

id string

The provider-assigned unique ID for this managed resource.

arn str

ARN of the anomaly subscription.

id str

The provider-assigned unique ID for this managed resource.

arn String

ARN of the anomaly subscription.

id String

The provider-assigned unique ID for this managed resource.

Look up an Existing AnomalySubscription Resource

Get an existing AnomalySubscription 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?: AnomalySubscriptionState, opts?: CustomResourceOptions): AnomalySubscription
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        account_id: Optional[str] = None,
        arn: Optional[str] = None,
        frequency: Optional[str] = None,
        monitor_arn_lists: Optional[Sequence[str]] = None,
        name: Optional[str] = None,
        subscribers: Optional[Sequence[AnomalySubscriptionSubscriberArgs]] = None,
        tags: Optional[Mapping[str, str]] = None,
        tags_all: Optional[Mapping[str, str]] = None,
        threshold: Optional[float] = None) -> AnomalySubscription
func GetAnomalySubscription(ctx *Context, name string, id IDInput, state *AnomalySubscriptionState, opts ...ResourceOption) (*AnomalySubscription, error)
public static AnomalySubscription Get(string name, Input<string> id, AnomalySubscriptionState? state, CustomResourceOptions? opts = null)
public static AnomalySubscription get(String name, Output<String> id, AnomalySubscriptionState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
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
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
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
The unique name of the resulting resource.
id
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
The unique name of the resulting resource.
id
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:
AccountId string

The unique identifier for the AWS account in which the anomaly subscription ought to be created.

Arn string

ARN of the anomaly subscription.

Frequency string

The frequency that anomaly reports are sent. Valid Values: DAILY | IMMEDIATE | WEEKLY.

MonitorArnLists List<string>

A list of cost anomaly monitors.

Name string

The name for the subscription.

Subscribers List<AnomalySubscriptionSubscriberArgs>

A subscriber configuration. Multiple subscribers can be defined.

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.

Threshold double

The dollar value that triggers a notification if the threshold is exceeded.

AccountId string

The unique identifier for the AWS account in which the anomaly subscription ought to be created.

Arn string

ARN of the anomaly subscription.

Frequency string

The frequency that anomaly reports are sent. Valid Values: DAILY | IMMEDIATE | WEEKLY.

MonitorArnLists []string

A list of cost anomaly monitors.

Name string

The name for the subscription.

Subscribers []AnomalySubscriptionSubscriberArgs

A subscriber configuration. Multiple subscribers can be defined.

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.

Threshold float64

The dollar value that triggers a notification if the threshold is exceeded.

accountId String

The unique identifier for the AWS account in which the anomaly subscription ought to be created.

arn String

ARN of the anomaly subscription.

frequency String

The frequency that anomaly reports are sent. Valid Values: DAILY | IMMEDIATE | WEEKLY.

monitorArnLists List<String>

A list of cost anomaly monitors.

name String

The name for the subscription.

subscribers List<AnomalySubscriptionSubscriberArgs>

A subscriber configuration. Multiple subscribers can be defined.

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.

threshold Double

The dollar value that triggers a notification if the threshold is exceeded.

accountId string

The unique identifier for the AWS account in which the anomaly subscription ought to be created.

arn string

ARN of the anomaly subscription.

frequency string

The frequency that anomaly reports are sent. Valid Values: DAILY | IMMEDIATE | WEEKLY.

monitorArnLists string[]

A list of cost anomaly monitors.

name string

The name for the subscription.

subscribers AnomalySubscriptionSubscriberArgs[]

A subscriber configuration. Multiple subscribers can be defined.

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.

threshold number

The dollar value that triggers a notification if the threshold is exceeded.

account_id str

The unique identifier for the AWS account in which the anomaly subscription ought to be created.

arn str

ARN of the anomaly subscription.

frequency str

The frequency that anomaly reports are sent. Valid Values: DAILY | IMMEDIATE | WEEKLY.

monitor_arn_lists Sequence[str]

A list of cost anomaly monitors.

name str

The name for the subscription.

subscribers Sequence[AnomalySubscriptionSubscriberArgs]

A subscriber configuration. Multiple subscribers can be defined.

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.

threshold float

The dollar value that triggers a notification if the threshold is exceeded.

accountId String

The unique identifier for the AWS account in which the anomaly subscription ought to be created.

arn String

ARN of the anomaly subscription.

frequency String

The frequency that anomaly reports are sent. Valid Values: DAILY | IMMEDIATE | WEEKLY.

monitorArnLists List<String>

A list of cost anomaly monitors.

name String

The name for the subscription.

subscribers List<Property Map>

A subscriber configuration. Multiple subscribers can be defined.

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.

threshold Number

The dollar value that triggers a notification if the threshold is exceeded.

Supporting Types

AnomalySubscriptionSubscriber

Address string

The address of the subscriber. If type is SNS, this will be the arn of the sns topic. If type is EMAIL, this will be the destination email address.

Type string

The type of subscription. Valid Values: SNS | EMAIL.

Address string

The address of the subscriber. If type is SNS, this will be the arn of the sns topic. If type is EMAIL, this will be the destination email address.

Type string

The type of subscription. Valid Values: SNS | EMAIL.

address String

The address of the subscriber. If type is SNS, this will be the arn of the sns topic. If type is EMAIL, this will be the destination email address.

type String

The type of subscription. Valid Values: SNS | EMAIL.

address string

The address of the subscriber. If type is SNS, this will be the arn of the sns topic. If type is EMAIL, this will be the destination email address.

type string

The type of subscription. Valid Values: SNS | EMAIL.

address str

The address of the subscriber. If type is SNS, this will be the arn of the sns topic. If type is EMAIL, this will be the destination email address.

type str

The type of subscription. Valid Values: SNS | EMAIL.

address String

The address of the subscriber. If type is SNS, this will be the arn of the sns topic. If type is EMAIL, this will be the destination email address.

type String

The type of subscription. Valid Values: SNS | EMAIL.

Import

aws_ce_anomaly_subscription can be imported using the id, e.g.

 $ pulumi import aws:costexplorer/anomalySubscription:AnomalySubscription example AnomalySubscriptionARN

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.