AnomalySubscription
Source:
src/AWS/CostExplorer/AnomalySubscription.ts
A Cost Explorer anomaly alert subscription. Attaches email or SNS
subscribers to one or more AnomalyMonitors with a notification
frequency and an impact threshold.
Cost Explorer is a global service — all calls are pinned to us-east-1
regardless of the stack region. Every property is mutable in place.
Creating Anomaly Subscriptions
Section titled “Creating Anomaly Subscriptions”Daily email digest for anomalies over $100
import * as CostExplorer from "alchemy/AWS/CostExplorer";
const monitor = yield* CostExplorer.AnomalyMonitor("ServiceSpend", { monitorType: "DIMENSIONAL", monitorDimension: "SERVICE",});
const subscription = yield* CostExplorer.AnomalySubscription("Alerts", { monitorArnList: [monitor.monitorArn], frequency: "DAILY", subscribers: [{ type: "EMAIL", address: "team@example.com" }], thresholdExpression: { Dimensions: { Key: "ANOMALY_TOTAL_IMPACT_ABSOLUTE", MatchOptions: ["GREATER_THAN_OR_EQUAL"], Values: ["100"], }, },});Immediate SNS notifications
const subscription = yield* CostExplorer.AnomalySubscription("PagerFeed", { monitorArnList: [monitor.monitorArn], frequency: "IMMEDIATE", subscribers: [{ type: "SNS", address: topic.topicArn }],});