metric_streams
Creates, updates, deletes, gets or lists a metric_streams resource.
Overview
| Name | metric_streams |
| Type | Resource |
| Id | aws.cloudwatch.metric_streams |
Fields
The following fields are returned by SELECT queries:
- get_metric_stream
| Name | Datatype | Description |
|---|---|---|
arn | string | The ARN of the metric stream. |
creation_date | string (date-time) | The date that the metric stream was created. |
exclude_filters | array | If 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_arn | string | The ARN of the Amazon Kinesis Data Firehose delivery stream that is used by this metric stream. |
include_filters | array | If 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_metrics | boolean | If 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_date | string (date-time) | The date of the most recent update to the metric stream's configuration. |
name | string | The name of the metric stream. |
output_format | string | The 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_arn | string | The ARN of the IAM role that is used by this metric stream. |
state | string | The state of the metric stream. The possible values are running and stopped. |
statistics_configurations | array | Each 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:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_metric_stream | select | region | Returns information about the metric stream that you specify. | |
put_metric_stream | replace | region, FirehoseArn, RoleArn, OutputFormat | 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. | |
delete_metric_stream | delete | region | Permanently deletes the metric stream that you specify. | |
list_metric_streams | exec | region | Returns a list of metric streams in this account. | |
start_metric_streams | exec | region, Names | Starts the streaming of metrics for one or more of your metric streams. | |
stop_metric_streams | exec | region, Names | Stops 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.
| Name | Datatype | Description |
|---|---|---|
region | string | AWS region (default: us-east-1) |
SELECT examples
- get_metric_stream
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
- put_metric_stream
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
- delete_metric_stream
Permanently deletes the metric stream that you specify.
DELETE FROM aws.cloudwatch.metric_streams
WHERE region = '{{ region }}' --required
;
Lifecycle Methods
- list_metric_streams
- start_metric_streams
- stop_metric_streams
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 }}
}'
;
Starts the streaming of metrics for one or more of your metric streams.
EXEC aws.cloudwatch.metric_streams.start_metric_streams
@region='{{ region }}' --required
@@json=
'{
"Names": "{{ Names }}"
}'
;
Stops the streaming of metrics for one or more of your metric streams.
EXEC aws.cloudwatch.metric_streams.stop_metric_streams
@region='{{ region }}' --required
@@json=
'{
"Names": "{{ Names }}"
}'
;