anomaly_subscriptions
Creates, updates, deletes or gets an anomaly_subscription resource or lists anomaly_subscriptions in a region
Overview
| Name | anomaly_subscriptions |
| Type | Resource |
| Description | AWS 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 |
| Id | awscc.ce.anomaly_subscriptions |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
subscription_arn | string | Subscription ARN |
subscription_name | string | The name of the subscription. |
account_id | string | The accountId |
monitor_arn_list | array | A list of cost anomaly monitors. |
subscribers | array | A list of subscriber |
threshold | number | The dollar value that triggers a notification if the threshold is exceeded. |
threshold_expression | string | An Expression object in JSON String format used to specify the anomalies that you want to generate alerts for. |
frequency | string | The frequency at which anomaly reports are sent over email. |
resource_tags | array | Tags to assign to subscription. |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
subscription_arn | string | Subscription ARN |
region | string | AWS region. |
For more information, see AWS::CE::AnomalySubscription.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | anomaly_subscriptions | INSERT | MonitorArnList, Subscribers, Frequency, SubscriptionName, region |
delete_resource | anomaly_subscriptions | DELETE | Identifier, region |
update_resource | anomaly_subscriptions | UPDATE | Identifier, PatchDocument, region |
list_resources | anomaly_subscriptions_list_only | SELECT | region |
get_resource | anomaly_subscriptions | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
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 }}';
Lists all anomaly_subscriptions in a region.
SELECT
region,
subscription_arn
FROM awscc.ce.anomaly_subscriptions_list_only
WHERE
region = '{{ region }}';
INSERT example
Use the following StackQL query and manifest file to create a new anomaly_subscription resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ 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
;
/*+ create */
INSERT INTO awscc.ce.anomaly_subscriptions (
SubscriptionName,
MonitorArnList,
Subscribers,
Threshold,
ThresholdExpression,
Frequency,
ResourceTags,
region
)
SELECT
'{{ subscription_name }}',
'{{ monitor_arn_list }}',
'{{ subscribers }}',
'{{ threshold }}',
'{{ threshold_expression }}',
'{{ frequency }}',
'{{ resource_tags }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: anomaly_subscription
props:
- name: subscription_name
value: '{{ subscription_name }}'
- name: monitor_arn_list
value:
- '{{ monitor_arn_list[0] }}'
- name: subscribers
value:
- address: '{{ address }}'
status: '{{ status }}'
type: '{{ type }}'
- name: threshold
value: null
- name: threshold_expression
value: '{{ threshold_expression }}'
- name: frequency
value: '{{ frequency }}'
- name: resource_tags
value:
- key: '{{ key }}'
value: '{{ value }}'
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:
| Parameter | Description |
|---|---|
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:
- Create
- Read
- Update
- Delete
- List
ce:CreateAnomalySubscription,
ce:TagResource
ce:GetAnomalySubscriptions,
ce:ListTagsForResource
ce:UpdateAnomalySubscription
ce:DeleteAnomalySubscription
ce:GetAnomalySubscriptions