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 | awscc.cloudwatch.metric_streams |
Fields
- get (all properties)
- list (identifiers only)
| 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. |
| Name | Datatype | Description |
|---|---|---|
name | string | Name of the metric stream. |
region | string | AWS region. |
For more information, see AWS::CloudWatch::MetricStream.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | metric_streams | INSERT | region |
delete_resource | metric_streams | DELETE | Identifier, region |
update_resource | metric_streams | UPDATE | Identifier, PatchDocument, region |
list_resources | metric_streams_list_only | SELECT | region |
get_resource | metric_streams | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
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 awscc.cloudwatch.metric_streams
WHERE
region = '{{ region }}' AND
Identifier = '{{ name }}';
Lists all metric_streams in a region.
SELECT
region,
name
FROM awscc.cloudwatch.metric_streams_list_only
WHERE
region = '{{ region }}';
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 awscc.cloudwatch.metric_streams (
ExcludeFilters,
FirehoseArn,
IncludeFilters,
Name,
RoleArn,
OutputFormat,
StatisticsConfigurations,
Tags,
IncludeLinkedAccountsMetrics,
region
)
SELECT
'{{ exclude_filters }}',
'{{ firehose_arn }}',
'{{ include_filters }}',
'{{ name }}',
'{{ role_arn }}',
'{{ output_format }}',
'{{ statistics_configurations }}',
'{{ tags }}',
'{{ include_linked_accounts_metrics }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
/*+ create */
INSERT INTO awscc.cloudwatch.metric_streams (
ExcludeFilters,
FirehoseArn,
IncludeFilters,
Name,
RoleArn,
OutputFormat,
StatisticsConfigurations,
Tags,
IncludeLinkedAccountsMetrics,
region
)
SELECT
'{{ exclude_filters }}',
'{{ firehose_arn }}',
'{{ include_filters }}',
'{{ name }}',
'{{ role_arn }}',
'{{ output_format }}',
'{{ statistics_configurations }}',
'{{ tags }}',
'{{ include_linked_accounts_metrics }}',
'{{ 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: metric_stream
props:
- name: exclude_filters
value:
- namespace: '{{ namespace }}'
metric_names:
- '{{ metric_names[0] }}'
- name: firehose_arn
value: '{{ firehose_arn }}'
- name: include_filters
value:
- null
- name: name
value: '{{ name }}'
- name: role_arn
value: '{{ role_arn }}'
- name: output_format
value: '{{ output_format }}'
- name: statistics_configurations
value:
- additional_statistics:
- '{{ additional_statistics[0] }}'
include_metrics:
- metric_name: '{{ metric_name }}'
namespace: '{{ namespace }}'
- name: tags
value:
- key: '{{ key }}'
value: '{{ value }}'
- name: include_linked_accounts_metrics
value: '{{ include_linked_accounts_metrics }}'
UPDATE example
Use the following StackQL query and manifest file to update a metric_stream resource, using stack-deploy.
/*+ update */
UPDATE awscc.cloudwatch.metric_streams
SET PatchDocument = string('{{ {
"ExcludeFilters": exclude_filters,
"FirehoseArn": firehose_arn,
"IncludeFilters": include_filters,
"RoleArn": role_arn,
"OutputFormat": output_format,
"StatisticsConfigurations": statistics_configurations,
"Tags": tags,
"IncludeLinkedAccountsMetrics": include_linked_accounts_metrics
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ name }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
DELETE example
/*+ delete */
DELETE FROM awscc.cloudwatch.metric_streams
WHERE
Identifier = '{{ name }}' 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 metric_streams resource, the following permissions are required:
- Create
- Update
- Delete
- List
- Read
cloudwatch:PutMetricStream,
cloudwatch:GetMetricStream,
cloudwatch:TagResource,
iam:PassRole
cloudwatch:PutMetricStream,
cloudwatch:GetMetricStream,
cloudwatch:TagResource,
cloudwatch:UntagResource,
iam:PassRole
cloudwatch:DeleteMetricStream,
cloudwatch:GetMetricStream
cloudwatch:ListMetricStreams
cloudwatch:GetMetricStream,
cloudwatch:ListTagsForResource