AWS Amazon EC2 Traffic Mirror Target

This page shows how to write Terraform and CloudFormation for Amazon EC2 Traffic Mirror Target and write them securely.

aws_ec2_traffic_mirror_target (Terraform)

The Traffic Mirror Target in Amazon EC2 can be configured in Terraform with the resource name aws_ec2_traffic_mirror_target. The following sections describe 5 examples of how to use the resource and its parameters.

Example Usage from GitHub

github-iconniveklabs/aws
resource "aws_ec2_traffic_mirror_target" "this" {
  description               = var.description
  network_interface_id      = var.network_interface_id
  network_load_balancer_arn = var.network_load_balancer_arn
  tags                      = var.tags
}
github-iconJamesWoolfenden/terraform-aws-trafficmirror
resource "aws_ec2_traffic_mirror_target" "target" {
  description               = var.mirror_target_description
  network_load_balancer_arn = var.network_load_balancer_arn
  #network_interface_id      = var.network_interface_id
  tags = var.common_tags
}
github-iconhands-on-cloud/amazon-vpc-traffic-inspection-and-monitoring
resource "aws_ec2_traffic_mirror_target" "suricata" {
  network_interface_id = data.terraform_remote_state.suricata.outputs.suricata_interface_id
}

resource "aws_ec2_traffic_mirror_session" "demo_ec2" {
  network_interface_id     = data.terraform_remote_state.base.outputs.demo_ec2_interface_id
github-iconjazhans/zeek_terransible_aws
resource "aws_ec2_traffic_mirror_target" "zeek_target" {
  provider                  = aws.region-master
  description               = "VPC Tap for Zeek"
  network_load_balancer_arn = aws_lb.ise-nlb-zk.arn
  tags = {
    Name = "NLB Mirror Target for Zeek Cluster"
github-iconjazhans/terraform_modules
resource "aws_ec2_traffic_mirror_target" "module_target" {
  description               = var.mirror_targ_desc
  network_load_balancer_arn = var.nlb_name
}
resource "aws_ec2_traffic_mirror_filter" "module_filter" {
  description = var.mirror_filt_desc

Parameters

Explanation in Terraform Registry

Provides a Traffic mirror target.
Read limits and considerations for traffic mirroring

AWS::EC2::TrafficMirrorTarget (CloudFormation)

The TrafficMirrorTarget in EC2 can be configured in CloudFormation with the resource name AWS::EC2::TrafficMirrorTarget. The following sections describe how to use the resource and its parameters.

Parameters

Explanation in CloudFormation Registry

Specifies a target for your Traffic Mirror session.

A Traffic Mirror target is the destination for mirrored traffic. The Traffic Mirror source and the Traffic Mirror target (monitoring appliances) can be in the same VPC, or in different VPCs connected via VPC peering or a transit gateway.

A Traffic Mirror target can be a network interface, or a Network Load Balancer.

To use the target in a Traffic Mirror session, use AWS::EC2::TrafficMirrorSession.

Frequently asked questions

What is AWS Amazon EC2 Traffic Mirror Target?

AWS Amazon EC2 Traffic Mirror Target is a resource for Amazon EC2 of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS Amazon EC2 Traffic Mirror Target?

For Terraform, the niveklabs/aws, JamesWoolfenden/terraform-aws-trafficmirror and hands-on-cloud/amazon-vpc-traffic-inspection-and-monitoring source code examples are useful. See the Terraform Example section for further details.