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
Idawscc.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.

For more information, see AWS::CE::AnomalySubscription.

Methods

NameResourceAccessible byRequired Params
create_resourceanomaly_subscriptionsINSERTMonitorArnList, Subscribers, Frequency, SubscriptionName, region
delete_resourceanomaly_subscriptionsDELETEIdentifier, region
update_resourceanomaly_subscriptionsUPDATEIdentifier, PatchDocument, region
list_resourcesanomaly_subscriptions_list_onlySELECTregion
get_resourceanomaly_subscriptionsSELECTIdentifier, region

SELECT examples

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 awscc.ce.anomaly_subscriptions
WHERE
region = '{{ region }}' AND
Identifier = '{{ subscription_arn }}';

INSERT example

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

/*+ create */
INSERT INTO awscc.ce.anomaly_subscriptions (
SubscriptionName,
MonitorArnList,
Subscribers,
Frequency,
region
)
SELECT
'{{ subscription_name }}',
'{{ monitor_arn_list }}',
'{{ subscribers }}',
'{{ frequency }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

UPDATE example

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

/*+ update */
UPDATE awscc.ce.anomaly_subscriptions
SET PatchDocument = string('{{ {
"SubscriptionName": subscription_name,
"MonitorArnList": monitor_arn_list,
"Threshold": threshold,
"ThresholdExpression": threshold_expression,
"Frequency": frequency
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ subscription_arn }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

DELETE example

/*+ delete */
DELETE FROM awscc.ce.anomaly_subscriptions
WHERE
Identifier = '{{ subscription_arn }}' AND
region = '{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

Additional Parameters

Mutable resources in the Cloud Control provider support additional optional parameters which can be supplied with INSERT, UPDATE, or DELETE operations. These include:

ParameterDescription
ClientToken
A unique identifier to ensure the idempotency of the resource request.This allows the provider to accurately distinguish between retries and new requests.
A client token is valid for 36 hours once used.
After that, a resource request with the same client token is treated as a new request.
If you do not specify a client token, one is generated for inclusion in the request.
RoleArn
The ARN of the IAM role used to perform this resource operation.The role specified must have the permissions required for this operation.
If you do not specify a role, a temporary session is created using your AWS user credentials.
TypeVersionId
For private resource types, the type version to use in this resource operation.If you do not specify a resource version, the default version is used.

Permissions

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

ce:CreateAnomalySubscription,
ce:TagResource