Skip to main content

anomaly_subscriptions

Creates, updates, deletes or gets an anomaly_subscription resource or lists anomaly_subscriptions in a region

Overview

Nameanomaly_subscriptions
TypeResource
DescriptionAWS Cost Anomaly Detection leverages advanced Machine Learning technologies to identify anomalous spend and root causes, so you can quickly take action. Create subscription to be notified
Idaws.ce.anomaly_subscriptions

Fields

NameDatatypeDescription
subscription_arnstringSubscription ARN
subscription_namestringThe name of the subscription.
account_idstringThe accountId
monitor_arn_listarrayA list of cost anomaly monitors.
subscribersarrayA list of subscriber
thresholdnumberThe dollar value that triggers a notification if the threshold is exceeded.
threshold_expressionstringAn Expression object in JSON String format used to specify the anomalies that you want to generate alerts for.
frequencystringThe frequency at which anomaly reports are sent over email.
resource_tagsarrayTags to assign to subscription.
regionstringAWS region.

Methods

NameAccessible byRequired Params
create_resourceINSERTMonitorArnList, Subscribers, Frequency, SubscriptionName, region
delete_resourceDELETEdata__Identifier, region
update_resourceUPDATEdata__Identifier, data__PatchDocument, region
list_resourcesSELECTregion
get_resourceSELECTdata__Identifier, region

SELECT examples

Gets all anomaly_subscriptions in a region.

SELECT
region,
subscription_arn,
subscription_name,
account_id,
monitor_arn_list,
subscribers,
threshold,
threshold_expression,
frequency,
resource_tags
FROM aws.ce.anomaly_subscriptions
WHERE region = 'us-east-1';

Gets all properties from an individual anomaly_subscription.

SELECT
region,
subscription_arn,
subscription_name,
account_id,
monitor_arn_list,
subscribers,
threshold,
threshold_expression,
frequency,
resource_tags
FROM aws.ce.anomaly_subscriptions
WHERE region = 'us-east-1' AND data__Identifier = '<SubscriptionArn>';

INSERT example

Use the following StackQL query and manifest file to create a new anomaly_subscription resource, using stack-deploy.

/*+ create */
INSERT INTO aws.ce.anomaly_subscriptions (
SubscriptionName,
MonitorArnList,
Subscribers,
Frequency,
region
)
SELECT
'{{ SubscriptionName }}',
'{{ MonitorArnList }}',
'{{ Subscribers }}',
'{{ Frequency }}',
'{{ region }}';

DELETE example

/*+ delete */
DELETE FROM aws.ce.anomaly_subscriptions
WHERE data__Identifier = '<SubscriptionArn>'
AND region = 'us-east-1';

Permissions

To operate on the anomaly_subscriptions resource, the following permissions are required:

Create

ce:CreateAnomalySubscription,
ce:TagResource

Read

ce:GetAnomalySubscriptions

Update

ce:UpdateAnomalySubscription

Delete

ce:DeleteAnomalySubscription

List

ce:GetAnomalySubscriptions