metric_streams
Creates, updates, deletes or gets a metric_stream
resource or lists metric_streams
in a region
Overview
Name | metric_streams |
Type | Resource |
Description | Resource Type definition for Metric Stream |
Id | aws.cloudwatch.metric_streams |
Fields
Name | Datatype | Description |
---|---|---|
arn | string | Amazon Resource Name of the metric stream. |
creation_date | string | The date of creation of the metric stream. |
exclude_filters | array | Define which metrics will be not streamed. Metrics matched by multiple instances of MetricStreamFilter are joined with an OR operation by default. If both IncludeFilters and ExcludeFilters are omitted, all metrics in the account will be streamed. IncludeFilters and ExcludeFilters are mutually exclusive. Default to null. |
firehose_arn | string | The ARN of the Kinesis Firehose where to stream the data. |
include_filters | array | Define which metrics will be streamed. Metrics matched by multiple instances of MetricStreamFilter are joined with an OR operation by default. If both IncludeFilters and ExcludeFilters are omitted, all metrics in the account will be streamed. IncludeFilters and ExcludeFilters are mutually exclusive. Default to null. |
last_update_date | string | The date of the last update of the metric stream. |
name | string | Name of the metric stream. |
role_arn | string | The ARN of the role that provides access to the Kinesis Firehose. |
state | string | Displays the state of the Metric Stream. |
output_format | string | The output format of the data streamed to the Kinesis Firehose. |
statistics_configurations | array | By default, a metric stream always sends the MAX, MIN, SUM, and SAMPLECOUNT statistics for each metric that is streamed. You can use this parameter to have the metric stream also send additional statistics in the stream. This array can have up to 100 members. |
tags | array | A set of tags to assign to the delivery stream. |
include_linked_accounts_metrics | boolean | If you are creating a metric stream in a monitoring account, specify true to include metrics from source accounts that are linked to this monitoring account, in the metric stream. The default is false. |
region | string | AWS region. |
Methods
Name | Accessible by | Required Params |
---|---|---|
create_resource | INSERT | FirehoseArn, RoleArn, OutputFormat, region |
delete_resource | DELETE | data__Identifier, region |
update_resource | UPDATE | data__Identifier, data__PatchDocument, region |
list_resources | SELECT | region |
get_resource | SELECT | data__Identifier, region |
SELECT
examples
Gets all metric_streams
in a region.
SELECT
region,
arn,
creation_date,
exclude_filters,
firehose_arn,
include_filters,
last_update_date,
name,
role_arn,
state,
output_format,
statistics_configurations,
tags,
include_linked_accounts_metrics
FROM aws.cloudwatch.metric_streams
WHERE region = 'us-east-1';
Gets all properties from an individual metric_stream
.
SELECT
region,
arn,
creation_date,
exclude_filters,
firehose_arn,
include_filters,
last_update_date,
name,
role_arn,
state,
output_format,
statistics_configurations,
tags,
include_linked_accounts_metrics
FROM aws.cloudwatch.metric_streams
WHERE region = 'us-east-1' AND data__Identifier = '<Name>';
INSERT
example
Use the following StackQL query and manifest file to create a new metric_stream
resource, using stack-deploy
.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO aws.cloudwatch.metric_streams (
FirehoseArn,
RoleArn,
OutputFormat,
region
)
SELECT
'{{ FirehoseArn }}',
'{{ RoleArn }}',
'{{ OutputFormat }}',
'{{ region }}';
/*+ create */
INSERT INTO aws.cloudwatch.metric_streams (
ExcludeFilters,
FirehoseArn,
IncludeFilters,
Name,
RoleArn,
OutputFormat,
StatisticsConfigurations,
Tags,
IncludeLinkedAccountsMetrics,
region
)
SELECT
'{{ ExcludeFilters }}',
'{{ FirehoseArn }}',
'{{ IncludeFilters }}',
'{{ Name }}',
'{{ RoleArn }}',
'{{ OutputFormat }}',
'{{ StatisticsConfigurations }}',
'{{ Tags }}',
'{{ IncludeLinkedAccountsMetrics }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: metric_stream
props:
- name: ExcludeFilters
value:
- Namespace: '{{ Namespace }}'
MetricNames:
- '{{ MetricNames[0] }}'
- name: FirehoseArn
value: '{{ FirehoseArn }}'
- name: IncludeFilters
value:
- null
- name: Name
value: '{{ Name }}'
- name: RoleArn
value: '{{ RoleArn }}'
- name: OutputFormat
value: '{{ OutputFormat }}'
- name: StatisticsConfigurations
value:
- AdditionalStatistics:
- '{{ AdditionalStatistics[0] }}'
IncludeMetrics:
- MetricName: '{{ MetricName }}'
Namespace: '{{ Namespace }}'
- name: Tags
value:
- Key: '{{ Key }}'
Value: '{{ Value }}'
- name: IncludeLinkedAccountsMetrics
value: '{{ IncludeLinkedAccountsMetrics }}'
DELETE
example
/*+ delete */
DELETE FROM aws.cloudwatch.metric_streams
WHERE data__Identifier = '<Name>'
AND region = 'us-east-1';
Permissions
To operate on the metric_streams
resource, the following permissions are required:
Create
cloudwatch:PutMetricStream,
cloudwatch:GetMetricStream,
cloudwatch:TagResource,
iam:PassRole
Update
cloudwatch:PutMetricStream,
cloudwatch:GetMetricStream,
cloudwatch:TagResource,
cloudwatch:UntagResource,
iam:PassRole
Delete
cloudwatch:DeleteMetricStream,
cloudwatch:GetMetricStream
List
cloudwatch:ListMetricStreams
Read
cloudwatch:GetMetricStream