UpdateAnomalySubscriptionCommand

Updates an existing cost anomaly subscription. Specify the fields that you want to update. Omitted fields are unchanged.

The JSON below describes the generic construct for each type. See Request Parameters  for possible values as they apply to AnomalySubscription.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { CostExplorerClient, UpdateAnomalySubscriptionCommand } from "@aws-sdk/client-cost-explorer"; // ES Modules import
// const { CostExplorerClient, UpdateAnomalySubscriptionCommand } = require("@aws-sdk/client-cost-explorer"); // CommonJS import
const client = new CostExplorerClient(config);
const input = { // UpdateAnomalySubscriptionRequest
  SubscriptionArn: "STRING_VALUE", // required
  Threshold: Number("double"),
  Frequency: "DAILY" || "IMMEDIATE" || "WEEKLY",
  MonitorArnList: [ // MonitorArnList
    "STRING_VALUE",
  ],
  Subscribers: [ // Subscribers
    { // Subscriber
      Address: "STRING_VALUE",
      Type: "EMAIL" || "SNS",
      Status: "CONFIRMED" || "DECLINED",
    },
  ],
  SubscriptionName: "STRING_VALUE",
  ThresholdExpression: { // Expression
    Or: [ // Expressions
      {
        Or: [
          "<Expression>",
        ],
        And: [
          "<Expression>",
        ],
        Not: "<Expression>",
        Dimensions: { // DimensionValues
          Key: "AZ" || "INSTANCE_TYPE" || "LINKED_ACCOUNT" || "LINKED_ACCOUNT_NAME" || "OPERATION" || "PURCHASE_TYPE" || "REGION" || "SERVICE" || "SERVICE_CODE" || "USAGE_TYPE" || "USAGE_TYPE_GROUP" || "RECORD_TYPE" || "OPERATING_SYSTEM" || "TENANCY" || "SCOPE" || "PLATFORM" || "SUBSCRIPTION_ID" || "LEGAL_ENTITY_NAME" || "DEPLOYMENT_OPTION" || "DATABASE_ENGINE" || "CACHE_ENGINE" || "INSTANCE_TYPE_FAMILY" || "BILLING_ENTITY" || "RESERVATION_ID" || "RESOURCE_ID" || "RIGHTSIZING_TYPE" || "SAVINGS_PLANS_TYPE" || "SAVINGS_PLAN_ARN" || "PAYMENT_OPTION" || "AGREEMENT_END_DATE_TIME_AFTER" || "AGREEMENT_END_DATE_TIME_BEFORE" || "INVOICING_ENTITY" || "ANOMALY_TOTAL_IMPACT_ABSOLUTE" || "ANOMALY_TOTAL_IMPACT_PERCENTAGE",
          Values: [ // Values
            "STRING_VALUE",
          ],
          MatchOptions: [ // MatchOptions
            "EQUALS" || "ABSENT" || "STARTS_WITH" || "ENDS_WITH" || "CONTAINS" || "CASE_SENSITIVE" || "CASE_INSENSITIVE" || "GREATER_THAN_OR_EQUAL",
          ],
        },
        Tags: { // TagValues
          Key: "STRING_VALUE",
          Values: [
            "STRING_VALUE",
          ],
          MatchOptions: [
            "EQUALS" || "ABSENT" || "STARTS_WITH" || "ENDS_WITH" || "CONTAINS" || "CASE_SENSITIVE" || "CASE_INSENSITIVE" || "GREATER_THAN_OR_EQUAL",
          ],
        },
        CostCategories: { // CostCategoryValues
          Key: "STRING_VALUE",
          Values: [
            "STRING_VALUE",
          ],
          MatchOptions: [
            "EQUALS" || "ABSENT" || "STARTS_WITH" || "ENDS_WITH" || "CONTAINS" || "CASE_SENSITIVE" || "CASE_INSENSITIVE" || "GREATER_THAN_OR_EQUAL",
          ],
        },
      },
    ],
    And: [
      "<Expression>",
    ],
    Not: "<Expression>",
    Dimensions: {
      Key: "AZ" || "INSTANCE_TYPE" || "LINKED_ACCOUNT" || "LINKED_ACCOUNT_NAME" || "OPERATION" || "PURCHASE_TYPE" || "REGION" || "SERVICE" || "SERVICE_CODE" || "USAGE_TYPE" || "USAGE_TYPE_GROUP" || "RECORD_TYPE" || "OPERATING_SYSTEM" || "TENANCY" || "SCOPE" || "PLATFORM" || "SUBSCRIPTION_ID" || "LEGAL_ENTITY_NAME" || "DEPLOYMENT_OPTION" || "DATABASE_ENGINE" || "CACHE_ENGINE" || "INSTANCE_TYPE_FAMILY" || "BILLING_ENTITY" || "RESERVATION_ID" || "RESOURCE_ID" || "RIGHTSIZING_TYPE" || "SAVINGS_PLANS_TYPE" || "SAVINGS_PLAN_ARN" || "PAYMENT_OPTION" || "AGREEMENT_END_DATE_TIME_AFTER" || "AGREEMENT_END_DATE_TIME_BEFORE" || "INVOICING_ENTITY" || "ANOMALY_TOTAL_IMPACT_ABSOLUTE" || "ANOMALY_TOTAL_IMPACT_PERCENTAGE",
      Values: [
        "STRING_VALUE",
      ],
      MatchOptions: [
        "EQUALS" || "ABSENT" || "STARTS_WITH" || "ENDS_WITH" || "CONTAINS" || "CASE_SENSITIVE" || "CASE_INSENSITIVE" || "GREATER_THAN_OR_EQUAL",
      ],
    },
    Tags: {
      Key: "STRING_VALUE",
      Values: [
        "STRING_VALUE",
      ],
      MatchOptions: [
        "EQUALS" || "ABSENT" || "STARTS_WITH" || "ENDS_WITH" || "CONTAINS" || "CASE_SENSITIVE" || "CASE_INSENSITIVE" || "GREATER_THAN_OR_EQUAL",
      ],
    },
    CostCategories: {
      Key: "STRING_VALUE",
      Values: "<Values>",
      MatchOptions: "<MatchOptions>",
    },
  },
};
const command = new UpdateAnomalySubscriptionCommand(input);
const response = await client.send(command);
// { // UpdateAnomalySubscriptionResponse
//   SubscriptionArn: "STRING_VALUE", // required
// };

UpdateAnomalySubscriptionCommand Input

Parameter
Type
Description
SubscriptionArn
Required
string | undefined

A cost anomaly subscription Amazon Resource Name (ARN).

Frequency
AnomalySubscriptionFrequency | undefined

The update to the frequency value that subscribers receive notifications.

MonitorArnList
string[] | undefined

A list of cost anomaly monitor ARNs.

Subscribers
Subscriber[] | undefined

The update to the subscriber list.

SubscriptionName
string | undefined

The new name of the subscription.

Threshold
number | undefined

(deprecated)

The update to the threshold value for receiving notifications.

This field has been deprecated. To update a threshold, use ThresholdExpression. Continued use of Threshold will be treated as shorthand syntax for a ThresholdExpression.

You can specify either Threshold or ThresholdExpression, but not both.

ThresholdExpression
Expression | undefined

The update to the Expression  object used to specify the anomalies that you want to generate alerts for. This supports dimensions and nested expressions. The supported dimensions are ANOMALY_TOTAL_IMPACT_ABSOLUTE and ANOMALY_TOTAL_IMPACT_PERCENTAGE, corresponding to an anomaly’s TotalImpact and TotalImpactPercentage, respectively (see Impact  for more details). The supported nested expression types are AND and OR. The match option GREATER_THAN_OR_EQUAL is required. Values must be numbers between 0 and 10,000,000,000 in string format.

You can specify either Threshold or ThresholdExpression, but not both.

The following are examples of valid ThresholdExpressions:

  • Absolute threshold: { "Dimensions": { "Key": "ANOMALY_TOTAL_IMPACT_ABSOLUTE", "MatchOptions": [ "GREATER_THAN_OR_EQUAL" ], "Values": [ "100" ] } }

  • Percentage threshold: { "Dimensions": { "Key": "ANOMALY_TOTAL_IMPACT_PERCENTAGE", "MatchOptions": [ "GREATER_THAN_OR_EQUAL" ], "Values": [ "100" ] } }

  • AND two thresholds together: { "And": [ { "Dimensions": { "Key": "ANOMALY_TOTAL_IMPACT_ABSOLUTE", "MatchOptions": [ "GREATER_THAN_OR_EQUAL" ], "Values": [ "100" ] } }, { "Dimensions": { "Key": "ANOMALY_TOTAL_IMPACT_PERCENTAGE", "MatchOptions": [ "GREATER_THAN_OR_EQUAL" ], "Values": [ "100" ] } } ] }

  • OR two thresholds together: { "Or": [ { "Dimensions": { "Key": "ANOMALY_TOTAL_IMPACT_ABSOLUTE", "MatchOptions": [ "GREATER_THAN_OR_EQUAL" ], "Values": [ "100" ] } }, { "Dimensions": { "Key": "ANOMALY_TOTAL_IMPACT_PERCENTAGE", "MatchOptions": [ "GREATER_THAN_OR_EQUAL" ], "Values": [ "100" ] } } ] }

UpdateAnomalySubscriptionCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
SubscriptionArn
Required
string | undefined

A cost anomaly subscription ARN.

Throws

Name
Fault
Details
LimitExceededException
client

You made too many calls in a short period of time. Try again later.

UnknownMonitorException
client

The cost anomaly monitor does not exist for the account.

UnknownSubscriptionException
client

The cost anomaly subscription does not exist for the account.

CostExplorerServiceException
Base exception class for all service exceptions from CostExplorer service.