Skip to main content

metric_streams

Creates, updates, deletes, gets or lists a metric_streams resource.

Overview

Namemetric_streams
TypeResource
Idaws.cloudwatch.metric_streams

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
arnstringThe ARN of the metric stream.
creation_datestring (date-time)The date that the metric stream was created.
exclude_filtersarrayIf this array of metric namespaces is present, then these namespaces are the only metric namespaces that are not streamed by this metric stream. In this case, all other metric namespaces in the account are streamed by this metric stream.
firehose_arnstringThe ARN of the Amazon Kinesis Data Firehose delivery stream that is used by this metric stream.
include_filtersarrayIf this array of metric namespaces is present, then these namespaces are the only metric namespaces that are streamed by this metric stream.
include_linked_accounts_metricsbooleanIf this is true and this metric stream is in a monitoring account, then the stream includes metrics from source accounts that the monitoring account is linked to.
last_update_datestring (date-time)The date of the most recent update to the metric stream's configuration.
namestringThe name of the metric stream.
output_formatstringThe output format for the stream. Valid values are json, opentelemetry1.0, and opentelemetry0.7. For more information about metric stream output formats, see Metric streams output formats. (json, opentelemetry0.7, opentelemetry1.0)
role_arnstringThe ARN of the IAM role that is used by this metric stream.
statestringThe state of the metric stream. The possible values are running and stopped.
statistics_configurationsarrayEach entry in this array displays information about one or more metrics that include additional statistics in the metric stream. For more information about the additional statistics, see CloudWatch statistics definitions.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_metric_streamselectregionReturns information about the metric stream that you specify.
put_metric_streamreplaceregion, FirehoseArn, RoleArn, OutputFormatCreates or updates a metric stream. Metric streams can automatically stream CloudWatch metrics to Amazon Web Services destinations, including Amazon S3, and to many third-party solutions. For more information, see Using Metric Streams. To create a metric stream, you must be signed in to an account that has the iam:PassRole permission and either the CloudWatchFullAccess policy or the cloudwatch:PutMetricStream permission. When you create or update a metric stream, you choose one of the following: Stream metrics from all metric namespaces in the account. Stream metrics from all metric namespaces in the account, except for the namespaces that you list in ExcludeFilters. Stream metrics from only the metric namespaces that you list in IncludeFilters. By default, a metric stream always sends the MAX, MIN, SUM, and SAMPLECOUNT statistics for each metric that is streamed. You can use the StatisticsConfigurations parameter to have the metric stream send additional statistics in the stream. Streaming additional statistics incurs additional costs. For more information, see Amazon CloudWatch Pricing. When you use PutMetricStream to create a new metric stream, the stream is created in the running state. If you use it to update an existing stream, the state of the stream is not changed. If you are using CloudWatch cross-account observability and you create a metric stream in a monitoring account, you can choose whether to include metrics from source accounts in the stream. For more information, see CloudWatch cross-account observability.
delete_metric_streamdeleteregionPermanently deletes the metric stream that you specify.
list_metric_streamsexecregionReturns a list of metric streams in this account.
start_metric_streamsexecregion, NamesStarts the streaming of metrics for one or more of your metric streams.
stop_metric_streamsexecregion, NamesStops the streaming of metrics for one or more of your metric streams.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples

Returns information about the metric stream that you specify.

SELECT
arn,
creation_date,
exclude_filters,
firehose_arn,
include_filters,
include_linked_accounts_metrics,
last_update_date,
name,
output_format,
role_arn,
state,
statistics_configurations
FROM aws.cloudwatch.metric_streams
WHERE region = '{{ region }}' -- required
;

REPLACE examples

Creates or updates a metric stream. Metric streams can automatically stream CloudWatch metrics to Amazon Web Services destinations, including Amazon S3, and to many third-party solutions. For more information, see Using Metric Streams. To create a metric stream, you must be signed in to an account that has the iam:PassRole permission and either the CloudWatchFullAccess policy or the cloudwatch:PutMetricStream permission. When you create or update a metric stream, you choose one of the following: Stream metrics from all metric namespaces in the account. Stream metrics from all metric namespaces in the account, except for the namespaces that you list in ExcludeFilters. Stream metrics from only the metric namespaces that you list in IncludeFilters. By default, a metric stream always sends the MAX, MIN, SUM, and SAMPLECOUNT statistics for each metric that is streamed. You can use the StatisticsConfigurations parameter to have the metric stream send additional statistics in the stream. Streaming additional statistics incurs additional costs. For more information, see Amazon CloudWatch Pricing. When you use PutMetricStream to create a new metric stream, the stream is created in the running state. If you use it to update an existing stream, the state of the stream is not changed. If you are using CloudWatch cross-account observability and you create a metric stream in a monitoring account, you can choose whether to include metrics from source accounts in the stream. For more information, see CloudWatch cross-account observability.

REPLACE aws.cloudwatch.metric_streams
SET
Name = '{{ Name }}',
IncludeFilters = '{{ IncludeFilters }}',
ExcludeFilters = '{{ ExcludeFilters }}',
FirehoseArn = '{{ FirehoseArn }}',
RoleArn = '{{ RoleArn }}',
OutputFormat = '{{ OutputFormat }}',
Tags = '{{ Tags }}',
StatisticsConfigurations = '{{ StatisticsConfigurations }}',
IncludeLinkedAccountsMetrics = {{ IncludeLinkedAccountsMetrics }}
WHERE
region = '{{ region }}' --required
AND FirehoseArn = '{{ FirehoseArn }}' --required
AND RoleArn = '{{ RoleArn }}' --required
AND OutputFormat = '{{ OutputFormat }}' --required
RETURNING
arn;

DELETE examples

Permanently deletes the metric stream that you specify.

DELETE FROM aws.cloudwatch.metric_streams
WHERE region = '{{ region }}' --required
;

Lifecycle Methods

Returns a list of metric streams in this account.

EXEC aws.cloudwatch.metric_streams.list_metric_streams
@region='{{ region }}' --required
@@json=
'{
"NextToken": "{{ NextToken }}",
"MaxResults": {{ MaxResults }}
}'
;