anomaly_monitors
Creates, updates, deletes or gets an anomaly_monitor resource or lists anomaly_monitors in a region
Overview
| Name | anomaly_monitors |
| 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. You can use Cost Anomaly Detection by creating monitor. |
| Id | awscc.ce.anomaly_monitors |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
monitor_arn | string | Subscription ARN |
monitor_type | string | |
monitor_name | string | The name of the monitor. |
creation_date | string | The date when the monitor was created. |
last_evaluated_date | string | The date when the monitor last evaluated for anomalies. |
last_updated_date | string | The date when the monitor was last updated. |
monitor_dimension | string | The dimensions to evaluate |
monitor_specification | string | |
dimensional_value_count | integer | The value for evaluated dimensions. |
resource_tags | array | Tags to assign to monitor. |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
monitor_arn | string | Subscription ARN |
region | string | AWS region. |
For more information, see AWS::CE::AnomalyMonitor.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | anomaly_monitors | INSERT | MonitorName, MonitorType, region |
delete_resource | anomaly_monitors | DELETE | Identifier, region |
update_resource | anomaly_monitors | UPDATE | Identifier, PatchDocument, region |
list_resources | anomaly_monitors_list_only | SELECT | region |
get_resource | anomaly_monitors | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual anomaly_monitor.
SELECT
region,
monitor_arn,
monitor_type,
monitor_name,
creation_date,
last_evaluated_date,
last_updated_date,
monitor_dimension,
monitor_specification,
dimensional_value_count,
resource_tags
FROM awscc.ce.anomaly_monitors
WHERE
region = '{{ region }}' AND
Identifier = '{{ monitor_arn }}';
Lists all anomaly_monitors in a region.
SELECT
region,
monitor_arn
FROM awscc.ce.anomaly_monitors_list_only
WHERE
region = '{{ region }}';
INSERT example
Use the following StackQL query and manifest file to create a new anomaly_monitor resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.ce.anomaly_monitors (
MonitorType,
MonitorName,
region
)
SELECT
'{{ monitor_type }}',
'{{ monitor_name }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
/*+ create */
INSERT INTO awscc.ce.anomaly_monitors (
MonitorType,
MonitorName,
MonitorDimension,
MonitorSpecification,
ResourceTags,
region
)
SELECT
'{{ monitor_type }}',
'{{ monitor_name }}',
'{{ monitor_dimension }}',
'{{ monitor_specification }}',
'{{ 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_monitor
props:
- name: monitor_type
value: '{{ monitor_type }}'
- name: monitor_name
value: '{{ monitor_name }}'
- name: monitor_dimension
value: '{{ monitor_dimension }}'
- name: monitor_specification
value: '{{ monitor_specification }}'
- name: resource_tags
value:
- key: '{{ key }}'
value: '{{ value }}'
UPDATE example
Use the following StackQL query and manifest file to update a anomaly_monitor resource, using stack-deploy.
/*+ update */
UPDATE awscc.ce.anomaly_monitors
SET PatchDocument = string('{{ {
"MonitorName": monitor_name
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ monitor_arn }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
DELETE example
/*+ delete */
DELETE FROM awscc.ce.anomaly_monitors
WHERE
Identifier = '{{ monitor_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_monitors resource, the following permissions are required:
- Create
- Read
- Update
- Delete
- List
ce:CreateAnomalyMonitor,
ce:TagResource
ce:GetAnomalyMonitors,
ce:ListTagsForResource
ce:UpdateAnomalyMonitor
ce:DeleteAnomalyMonitor
ce:GetAnomalyMonitors