

This is the new *CloudFormation Template Reference Guide*. Please update your bookmarks and links. For help getting started with CloudFormation, see the [AWS CloudFormation User Guide](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html).

# AWS::CloudWatch::MetricStream
<a name="aws-resource-cloudwatch-metricstream"></a>

Creates or updates a metric stream. Metrics streams can automatically stream CloudWatch metrics to AWS destinations including Amazon S3 and to many third-party solutions. For more information, see [ Metric streams](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Metric-Streams.html). 

To create a metric stream, you must be logged on 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`. 

When you create a metric stream, the stream is created in the `running` state. If you update an existing metric stream, the state does not change.

If you create a metric stream in an account that has been set up as a monitoring account in CloudWatch cross-account observability, you can choose whether to include metrics from linked source accounts in the metric stream.

## Syntax
<a name="aws-resource-cloudwatch-metricstream-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-resource-cloudwatch-metricstream-syntax.json"></a>

```
{
  "Type" : "AWS::CloudWatch::MetricStream",
  "Properties" : {
      "[ExcludeFilters](#cfn-cloudwatch-metricstream-excludefilters)" : [ MetricStreamFilter, ... ],
      "[FirehoseArn](#cfn-cloudwatch-metricstream-firehosearn)" : String,
      "[IncludeFilters](#cfn-cloudwatch-metricstream-includefilters)" : [ MetricStreamFilter, ... ],
      "[IncludeLinkedAccountsMetrics](#cfn-cloudwatch-metricstream-includelinkedaccountsmetrics)" : Boolean,
      "[Name](#cfn-cloudwatch-metricstream-name)" : String,
      "[OutputFormat](#cfn-cloudwatch-metricstream-outputformat)" : String,
      "[RoleArn](#cfn-cloudwatch-metricstream-rolearn)" : String,
      "[StatisticsConfigurations](#cfn-cloudwatch-metricstream-statisticsconfigurations)" : [ MetricStreamStatisticsConfiguration, ... ],
      "[Tags](#cfn-cloudwatch-metricstream-tags)" : [ Tag, ... ]
    }
}
```

### YAML
<a name="aws-resource-cloudwatch-metricstream-syntax.yaml"></a>

```
Type: AWS::CloudWatch::MetricStream
Properties:
  [ExcludeFilters](#cfn-cloudwatch-metricstream-excludefilters): 
    - MetricStreamFilter
  [FirehoseArn](#cfn-cloudwatch-metricstream-firehosearn): String
  [IncludeFilters](#cfn-cloudwatch-metricstream-includefilters): 
    - MetricStreamFilter
  [IncludeLinkedAccountsMetrics](#cfn-cloudwatch-metricstream-includelinkedaccountsmetrics): Boolean
  [Name](#cfn-cloudwatch-metricstream-name): String
  [OutputFormat](#cfn-cloudwatch-metricstream-outputformat): String
  [RoleArn](#cfn-cloudwatch-metricstream-rolearn): String
  [StatisticsConfigurations](#cfn-cloudwatch-metricstream-statisticsconfigurations): 
    - MetricStreamStatisticsConfiguration
  [Tags](#cfn-cloudwatch-metricstream-tags): 
    - Tag
```

## Properties
<a name="aws-resource-cloudwatch-metricstream-properties"></a>

`ExcludeFilters`  <a name="cfn-cloudwatch-metricstream-excludefilters"></a>
If you specify this parameter, the stream sends metrics from all metric namespaces except for the namespaces that you specify here. You cannot specify both `IncludeFilters` and `ExcludeFilters` in the same metric stream.  
When you modify the `IncludeFilters` or `ExcludeFilters` of an existing metric stream in any way, the metric stream is effectively restarted, so after such a change you will get only the datapoints that have a timestamp after the time of the update.  
*Required*: No  
*Type*: Array of [MetricStreamFilter](aws-properties-cloudwatch-metricstream-metricstreamfilter.md)  
*Maximum*: `1000`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`FirehoseArn`  <a name="cfn-cloudwatch-metricstream-firehosearn"></a>
The ARN of the Amazon Kinesis Firehose delivery stream to use for this metric stream. This Amazon Kinesis Firehose delivery stream must already exist and must be in the same account as the metric stream.   
*Required*: No  
*Type*: String  
*Minimum*: `20`  
*Maximum*: `2048`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`IncludeFilters`  <a name="cfn-cloudwatch-metricstream-includefilters"></a>
If you specify this parameter, the stream sends only the metrics from the metric namespaces that you specify here. You cannot specify both `IncludeFilters` and `ExcludeFilters` in the same metric stream.  
When you modify the `IncludeFilters` or `ExcludeFilters` of an existing metric stream in any way, the metric stream is effectively restarted, so after such a change you will get only the datapoints that have a timestamp after the time of the update.  
*Required*: No  
*Type*: Array of [MetricStreamFilter](aws-properties-cloudwatch-metricstream-metricstreamfilter.md)  
*Maximum*: `1000`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`IncludeLinkedAccountsMetrics`  <a name="cfn-cloudwatch-metricstream-includelinkedaccountsmetrics"></a>
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`.  
For more information about linking accounts, see [CloudWatch cross-account observability](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Unified-Cross-Account.html)  
*Required*: No  
*Type*: Boolean  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Name`  <a name="cfn-cloudwatch-metricstream-name"></a>
If you are creating a new metric stream, this is the name for the new stream. The name must be different than the names of other metric streams in this account and Region.  
If you are updating a metric stream, specify the name of that stream here.  
*Required*: No  
*Type*: String  
*Minimum*: `1`  
*Maximum*: `255`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`OutputFormat`  <a name="cfn-cloudwatch-metricstream-outputformat"></a>
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](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-metric-streams-formats.html).  
This parameter is required.  
*Required*: No  
*Type*: String  
*Minimum*: `1`  
*Maximum*: `255`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`RoleArn`  <a name="cfn-cloudwatch-metricstream-rolearn"></a>
The ARN of an IAM role that this metric stream will use to access Amazon Kinesis Firehose resources. This IAM role must already exist and must be in the same account as the metric stream. This IAM role must include the `firehose:PutRecord` and `firehose:PutRecordBatch` permissions.  
*Required*: No  
*Type*: String  
*Minimum*: `20`  
*Maximum*: `2048`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`StatisticsConfigurations`  <a name="cfn-cloudwatch-metricstream-statisticsconfigurations"></a>
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.  
For each entry in this array, you specify one or more metrics and the list of additional statistics to stream for those metrics. The additional statistics that you can stream depend on the stream's `OutputFormat`. If the `OutputFormat` is `json`, you can stream any additional statistic that is supported by CloudWatch, listed in [CloudWatch statistics definitions](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Statistics-definitions.html). If the `OutputFormat` is OpenTelemetry, you can stream percentile statistics.  
*Required*: No  
*Type*: Array of [MetricStreamStatisticsConfiguration](aws-properties-cloudwatch-metricstream-metricstreamstatisticsconfiguration.md)  
*Maximum*: `100`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Tags`  <a name="cfn-cloudwatch-metricstream-tags"></a>
An array of key-value pairs to apply to the metric stream.  
For more information, see [Tag](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-resource-tags.html).  
*Required*: No  
*Type*: Array of [Tag](aws-properties-cloudwatch-metricstream-tag.md)  
*Maximum*: `50`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

## Return values
<a name="aws-resource-cloudwatch-metricstream-return-values"></a>

### Ref
<a name="aws-resource-cloudwatch-metricstream-return-values-ref"></a>

When you pass the logical ID of this resource to the intrinsic `Ref` function, `Ref` returns the name of the metric stream.

For more information about using the `Ref` function, see [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html).

### Fn::GetAtt
<a name="aws-resource-cloudwatch-metricstream-return-values-fn--getatt"></a>

The `Fn::GetAtt` intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.

For more information about using the `Fn::GetAtt` intrinsic function, see [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-getatt.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-getatt.html).

#### 
<a name="aws-resource-cloudwatch-metricstream-return-values-fn--getatt-fn--getatt"></a>

`Arn`  <a name="Arn-fn::getatt"></a>
The ARN of the metric stream.

`CreationDate`  <a name="CreationDate-fn::getatt"></a>
The date that the metric stream was originally created.

`LastUpdateDate`  <a name="LastUpdateDate-fn::getatt"></a>
The date that the metric stream was most recently updated.

`State`  <a name="State-fn::getatt"></a>
The state of the metric stream, either `running` or `stopped`.

## Examples
<a name="aws-resource-cloudwatch-metricstream--examples"></a>

### Metric stream example
<a name="aws-resource-cloudwatch-metricstream--examples--Metric_stream_example"></a>

The following example creates a metric stream that streams only the metrics in the `AWS/ELB` and `AWS/EC2` namespaces.

#### YAML
<a name="aws-resource-cloudwatch-metricstream--examples--Metric_stream_example--yaml"></a>

```
Resources:
  MyMetricStream:
    Type: 'AWS::CloudWatch::MetricStream'
    Properties:
      OutputFormat: 'json'
      FirehoseArn: 'arn:aws:firehose:us-east-1:123456789012:deliverystream/MyDeliveryStream'
      RoleArn: 'arn:aws:iam::123456789012:role/service-role/MyRole'
      IncludeFilters:
        - Namespace: AWS/ELB
        - Namespace: AWS/EC2
```

#### JSON
<a name="aws-resource-cloudwatch-metricstream--examples--Metric_stream_example--json"></a>

```
{
  "Type" : "AWS::CloudWatch::MetricStream",
  "Properties" : {
    "FirehoseArn" : "arn:aws:firehose:us-east-1:123456789012:deliverystream/MyDeliveryStream",
    "IncludeFilters" : [
      {
        "Namespace": "AWS/ELB"
      },
      {
        "Namespace": "AWS/EC2"
      }
    ],
    "Name" : "MyMetricStream",
    "OutputFormat" : "json",
    "RoleArn" : "arn:aws:iam::123456789012:role/service-role/MyRole"
  }
}
```

# AWS::CloudWatch::MetricStream MetricStreamFilter
<a name="aws-properties-cloudwatch-metricstream-metricstreamfilter"></a>

This structure contains a metric namespace and optionally, a list of metric names, to either include in a metric ' stream or exclude from a metric stream.

A metric stream's filters can include up to 1000 total names. This limit applies to the sum of namespace names and metric names in the filters. For example, this could include 10 metric namespace filters with 99 metrics each, or 20 namespace filters with 49 metrics specified in each filter. 

## Syntax
<a name="aws-properties-cloudwatch-metricstream-metricstreamfilter-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-cloudwatch-metricstream-metricstreamfilter-syntax.json"></a>

```
{
  "[MetricNames](#cfn-cloudwatch-metricstream-metricstreamfilter-metricnames)" : [ String, ... ],
  "[Namespace](#cfn-cloudwatch-metricstream-metricstreamfilter-namespace)" : String
}
```

### YAML
<a name="aws-properties-cloudwatch-metricstream-metricstreamfilter-syntax.yaml"></a>

```
  [MetricNames](#cfn-cloudwatch-metricstream-metricstreamfilter-metricnames): 
    - String
  [Namespace](#cfn-cloudwatch-metricstream-metricstreamfilter-namespace): String
```

## Properties
<a name="aws-properties-cloudwatch-metricstream-metricstreamfilter-properties"></a>

`MetricNames`  <a name="cfn-cloudwatch-metricstream-metricstreamfilter-metricnames"></a>
The names of the metrics to either include or exclude from the metric stream.  
If you omit this parameter, all metrics in the namespace are included or excluded, depending on whether this filter is specified as an exclude filter or an include filter.  
Each metric name can contain only ASCII printable characters (ASCII range 32 through 126). Each metric name must contain at least one non-whitespace character.  
*Required*: No  
*Type*: Array of String  
*Minimum*: `1`  
*Maximum*: `255 | 999`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Namespace`  <a name="cfn-cloudwatch-metricstream-metricstreamfilter-namespace"></a>
The name of the metric namespace in the filter.  
The namespace can contain only ASCII printable characters (ASCII range 32 through 126). It must contain at least one non-whitespace character.  
*Required*: Yes  
*Type*: String  
*Minimum*: `1`  
*Maximum*: `255`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

# AWS::CloudWatch::MetricStream MetricStreamStatisticsConfiguration
<a name="aws-properties-cloudwatch-metricstream-metricstreamstatisticsconfiguration"></a>

This structure specifies a list of additional statistics to stream, and the metrics to stream those additional statistics for.

All metrics that match the combination of metric name and namespace will be streamed with the additional statistics, no matter their dimensions.

## Syntax
<a name="aws-properties-cloudwatch-metricstream-metricstreamstatisticsconfiguration-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-cloudwatch-metricstream-metricstreamstatisticsconfiguration-syntax.json"></a>

```
{
  "[AdditionalStatistics](#cfn-cloudwatch-metricstream-metricstreamstatisticsconfiguration-additionalstatistics)" : [ String, ... ],
  "[IncludeMetrics](#cfn-cloudwatch-metricstream-metricstreamstatisticsconfiguration-includemetrics)" : [ MetricStreamStatisticsMetric, ... ]
}
```

### YAML
<a name="aws-properties-cloudwatch-metricstream-metricstreamstatisticsconfiguration-syntax.yaml"></a>

```
  [AdditionalStatistics](#cfn-cloudwatch-metricstream-metricstreamstatisticsconfiguration-additionalstatistics): 
    - String
  [IncludeMetrics](#cfn-cloudwatch-metricstream-metricstreamstatisticsconfiguration-includemetrics): 
    - MetricStreamStatisticsMetric
```

## Properties
<a name="aws-properties-cloudwatch-metricstream-metricstreamstatisticsconfiguration-properties"></a>

`AdditionalStatistics`  <a name="cfn-cloudwatch-metricstream-metricstreamstatisticsconfiguration-additionalstatistics"></a>
The additional statistics to stream for the metrics listed in `IncludeMetrics`.  
*Required*: Yes  
*Type*: Array of String  
*Maximum*: `20`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`IncludeMetrics`  <a name="cfn-cloudwatch-metricstream-metricstreamstatisticsconfiguration-includemetrics"></a>
An array that defines the metrics that are to have additional statistics streamed.  
*Required*: Yes  
*Type*: Array of [MetricStreamStatisticsMetric](aws-properties-cloudwatch-metricstream-metricstreamstatisticsmetric.md)  
*Maximum*: `100`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

# AWS::CloudWatch::MetricStream MetricStreamStatisticsMetric
<a name="aws-properties-cloudwatch-metricstream-metricstreamstatisticsmetric"></a>

A structure that specifies the metric name and namespace for one metric that is going to have additional statistics included in the stream.

## Syntax
<a name="aws-properties-cloudwatch-metricstream-metricstreamstatisticsmetric-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-cloudwatch-metricstream-metricstreamstatisticsmetric-syntax.json"></a>

```
{
  "[MetricName](#cfn-cloudwatch-metricstream-metricstreamstatisticsmetric-metricname)" : String,
  "[Namespace](#cfn-cloudwatch-metricstream-metricstreamstatisticsmetric-namespace)" : String
}
```

### YAML
<a name="aws-properties-cloudwatch-metricstream-metricstreamstatisticsmetric-syntax.yaml"></a>

```
  [MetricName](#cfn-cloudwatch-metricstream-metricstreamstatisticsmetric-metricname): String
  [Namespace](#cfn-cloudwatch-metricstream-metricstreamstatisticsmetric-namespace): String
```

## Properties
<a name="aws-properties-cloudwatch-metricstream-metricstreamstatisticsmetric-properties"></a>

`MetricName`  <a name="cfn-cloudwatch-metricstream-metricstreamstatisticsmetric-metricname"></a>
The name of the metric.  
*Required*: Yes  
*Type*: String  
*Minimum*: `1`  
*Maximum*: `255`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Namespace`  <a name="cfn-cloudwatch-metricstream-metricstreamstatisticsmetric-namespace"></a>
The namespace of the metric.  
*Required*: Yes  
*Type*: String  
*Minimum*: `1`  
*Maximum*: `255`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

# AWS::CloudWatch::MetricStream Tag
<a name="aws-properties-cloudwatch-metricstream-tag"></a>

A key-value pair associated with a CloudWatch resource.

## Syntax
<a name="aws-properties-cloudwatch-metricstream-tag-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-cloudwatch-metricstream-tag-syntax.json"></a>

```
{
  "[Key](#cfn-cloudwatch-metricstream-tag-key)" : String,
  "[Value](#cfn-cloudwatch-metricstream-tag-value)" : String
}
```

### YAML
<a name="aws-properties-cloudwatch-metricstream-tag-syntax.yaml"></a>

```
  [Key](#cfn-cloudwatch-metricstream-tag-key): String
  [Value](#cfn-cloudwatch-metricstream-tag-value): String
```

## Properties
<a name="aws-properties-cloudwatch-metricstream-tag-properties"></a>

`Key`  <a name="cfn-cloudwatch-metricstream-tag-key"></a>
A string that you can use to assign a value. The combination of tag keys and values can help you organize and categorize your resources.  
*Required*: Yes  
*Type*: String  
*Minimum*: `1`  
*Maximum*: `128`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Value`  <a name="cfn-cloudwatch-metricstream-tag-value"></a>
The value for the specified tag key.  
*Required*: Yes  
*Type*: String  
*Minimum*: `0`  
*Maximum*: `256`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)