

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::EC2::TrafficMirrorFilter
<a name="aws-resource-ec2-trafficmirrorfilter"></a>

Specifies a Traffic Mirror filter.

A Traffic Mirror filter is a set of rules that defines the traffic to mirror.

By default, no traffic is mirrored. To mirror traffic, use [AWS::EC2::TrafficMirrorFilterRule](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorfilterrule.html) to add Traffic Mirror rules to the filter. The rules you add define what traffic gets mirrored.

## Syntax
<a name="aws-resource-ec2-trafficmirrorfilter-syntax"></a>

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

### JSON
<a name="aws-resource-ec2-trafficmirrorfilter-syntax.json"></a>

```
{
  "Type" : "AWS::EC2::TrafficMirrorFilter",
  "Properties" : {
      "[Description](#cfn-ec2-trafficmirrorfilter-description)" : String,
      "[NetworkServices](#cfn-ec2-trafficmirrorfilter-networkservices)" : [ String, ... ],
      "[Tags](#cfn-ec2-trafficmirrorfilter-tags)" : [ Tag, ... ]
    }
}
```

### YAML
<a name="aws-resource-ec2-trafficmirrorfilter-syntax.yaml"></a>

```
Type: AWS::EC2::TrafficMirrorFilter
Properties:
  [Description](#cfn-ec2-trafficmirrorfilter-description): String
  [NetworkServices](#cfn-ec2-trafficmirrorfilter-networkservices): 
    - String
  [Tags](#cfn-ec2-trafficmirrorfilter-tags): 
    - Tag
```

## Properties
<a name="aws-resource-ec2-trafficmirrorfilter-properties"></a>

`Description`  <a name="cfn-ec2-trafficmirrorfilter-description"></a>
The description of the Traffic Mirror filter.  
*Required*: No  
*Type*: String  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`NetworkServices`  <a name="cfn-ec2-trafficmirrorfilter-networkservices"></a>
The network service traffic that is associated with the Traffic Mirror filter.  
Valid values are `amazon-dns`.  
*Required*: No  
*Type*: Array of String  
*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-ec2-trafficmirrorfilter-tags"></a>
The tags to assign to a Traffic Mirror filter.  
*Required*: No  
*Type*: Array of [Tag](aws-properties-ec2-trafficmirrorfilter-tag.md)  
*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-ec2-trafficmirrorfilter-return-values"></a>

### Ref
<a name="aws-resource-ec2-trafficmirrorfilter-return-values-ref"></a>

When you pass the logical ID of this resource to the intrinsic `Ref` function, `Ref` returns the ID of the Traffic Mirror filter.

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).

## Examples
<a name="aws-resource-ec2-trafficmirrorfilter--examples"></a>

### Create a traffic mirror filter
<a name="aws-resource-ec2-trafficmirrorfilter--examples--Create_a_traffic_mirror_filter"></a>

This is a filter that you can use when you create a traffic mirror session. This filter also configures mirroring of Amazon DNS network services.

#### JSON
<a name="aws-resource-ec2-trafficmirrorfilter--examples--Create_a_traffic_mirror_filter--json"></a>

```
{
  "SampleTrafficMirrorFilter": {
    "Type": "AWS::EC2::TrafficMirrorFilter",
    "Properties": {
      "Description": "Example traffic mirror filter",
      "NetworkServices": [
        "amazon-dns"
      ],
      "Tags": [
        {
          "Key": "Name",
          "Value": "SampleFilter"
        }
      ]
    }
  }
}
```

#### YAML
<a name="aws-resource-ec2-trafficmirrorfilter--examples--Create_a_traffic_mirror_filter--yaml"></a>

```
SampleTrafficMirrorFilter:
  Type: "AWS::EC2::TrafficMirrorFilter"
  Properties:
    Description: "Example traffic mirror filter"
    NetworkServices:
      - "amazon-dns"
    Tags:
    - Key: "Name"
      Value: "SampleFilter"
```

## See also
<a name="aws-resource-ec2-trafficmirrorfilter--seealso"></a>
+ [Traffic mirror filters and filter rules](https://docs.aws.amazon.com/vpc/latest/mirroring/traffic-mirroring-filters.html) in *Traffic Mirroring*
+ [CreateTrafficMirrorFilter](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateTrafficMirrorFilter.html) in the *Amazon EC2 API Reference*



# AWS::EC2::TrafficMirrorFilter Tag
<a name="aws-properties-ec2-trafficmirrorfilter-tag"></a>

Specifies a tag. For more information, see [Resource tags](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-resource-tags.html).

## Syntax
<a name="aws-properties-ec2-trafficmirrorfilter-tag-syntax"></a>

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

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

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

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

```
  [Key](#cfn-ec2-trafficmirrorfilter-tag-key): String
  [Value](#cfn-ec2-trafficmirrorfilter-tag-value): String
```

## Properties
<a name="aws-properties-ec2-trafficmirrorfilter-tag-properties"></a>

`Key`  <a name="cfn-ec2-trafficmirrorfilter-tag-key"></a>
The tag key.  
*Required*: Yes  
*Type*: String  
*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-ec2-trafficmirrorfilter-tag-value"></a>
The tag value.  
*Required*: Yes  
*Type*: String  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

## Examples
<a name="aws-properties-ec2-trafficmirrorfilter-tag--examples"></a>

### 
<a name="aws-properties-ec2-trafficmirrorfilter-tag--examples--"></a>

This example specifies two tags for the Traffic Mirror filter.

#### JSON
<a name="aws-properties-ec2-trafficmirrorfilter-tag--examples----json"></a>

```
"Tags" : [
   {
      "Key" : "key1",
      "Value" : "value1"
   },
   {
      "Key" : "key2",
      "Value" : "value2"
   }
]
```

#### YAML
<a name="aws-properties-ec2-trafficmirrorfilter-tag--examples----yaml"></a>

```
Tags: 
  - Key: "key1"
    Value: "value1"
  - Key: "key2"
    Value: "value2"
```