Get started with Traffic Mirroring
The following tasks help you to become familiar with traffic mirror targets, filters, and sessions. Follow the instructions to create a traffic mirror target and filter, and then use those resources to create a session.
Tasks
Prerequisites
Review the Traffic Mirroring considerations. For more information, see Traffic Mirroring considerations. Also verify the following.
-
Make sure that the traffic mirror source and traffic mirror target are either:
-
In the same VPC, or
-
In different VPCs that are connected via VPC peering, a transit gateway, or a Gateway Load Balancer endpoint.
-
-
The traffic mirror target instance must allow traffic to UDP port 4789.
-
The traffic mirror source must have a route table entry for the traffic mirror target.
-
Security group rules and network ACL rules on the traffic mirror target cannot drop the mirrored traffic from the traffic mirror source.
Step 1: Create the traffic mirror target
Create a destination for mirrored traffic.
Create a traffic mirror target
-
Open the Amazon VPC console at https://console.aws.amazon.com/vpc/
. -
In the Region selector, choose the AWS Region that you used when you created the VPCs.
-
On the navigation pane, choose Traffic Mirroring, Mirror Targets.
-
Choose Create traffic mirror target.
-
(Optional) For Name tag, enter a name for the traffic mirror target.
-
(Optional) For Description, enter a description for the traffic mirror target.
-
For Target type, choose the traffic mirror target type.
-
For Target, choose the traffic mirror target.
-
(Optional) For each tag to add, choose Add new tag and enter the tag key and tag value.
-
Choose Create.
Step 2: Create the traffic mirror filter
A traffic mirror filter contains one or more traffic mirror rules, and a set of network services. The filters and rules that you add define the traffic that is mirrored.
To create a traffic mirror filter
-
On the navigation pane, choose Traffic Mirroring, Mirror Filters.
-
Choose Create traffic mirror filter.
-
(Optional For Name tag, enter a name for the traffic mirror filter.
-
(Optional) For Description, enter a description for the traffic mirror filter.
-
(Optional) Mirror network services.
[Mirror Amazon DNS traffic] Select amazon-dns.
-
(Optional) For each inbound rule, choose Inbound rules, Add rule, and then specify the following information:
-
Number: Enter a priority to assign to the rule.
-
Rule action: Choose the action to take for the packet.
-
Protocol: Choose the L4 protocol to assign to the rule.
-
(Optional) Source port range: Enter the source port range.
-
(Optional) Destination port range: Enter the destination port range.
-
Source CIDR block: Enter a source CIDR block.
-
Destination CIDR block: Enter a destination CIDR block.
-
Description: Enter a description for the rule.
-
-
(Optional) For each outbound rule, choose Outbound rules, Add rule, and then specify the following information:
-
Number: Enter a priority to assign to the rule.
-
Rule action: Choose the action to take for the packet.
-
Protocol: Choose the IP protocol to assign to the rule.
-
(Optional) Source port range: Enter the source port range.
-
(Optional) Destination port range: Enter the destination port range.
-
Source CIDR block: Enter a source CIDR block.
-
Destination CIDR block: Enter a destination CIDR block.
-
Description: Enter a description for the rule.
-
-
(Optional) For each tag to add, choose Add new tag and enter the tag key and tag value.
-
Choose Create.
Step 3: Create the traffic mirror session
Create a traffic mirror session that sends mirrored packets from the source to a target so that you can monitor and analyze traffic.
To create a traffic mirror session
In the navigation pane, choose Traffic Mirroring, Mirror Sessions.
-
Choose Create traffic mirror session.
-
(Optional) For Name tag, enter a name for the traffic mirror session.
-
(Optional) For Description, enter a description for the traffic mirror session.
-
For Mirror source, choose the network interface of the instance that you want to monitor.
-
For Mirror target, choose the traffic mirror target.
-
For Additional settings, do the following:
-
For Session number, enter the session number. The valid values are 1 to 32,766, where 1 is the highest priority.
The session number determines the order that traffic mirror sessions are evaluated in both of the following situations:
-
When an interface is used by multiple sessions.
-
When an interface is used by different traffic mirror targets and traffic mirror filters.
Traffic is only mirrored one time.
-
-
(Optional) For VNI, enter the VXLAN ID to use for the traffic mirror session. For more information about the VXLAN protocol, see RFC 7348
. If you do not enter a value, we assign a random unused number.
-
(Optional) For Packet Length, enter the number of bytes in each packet to mirror.
If you do not want to mirror the entire packet, set Packet Length to the number of bytes in each packet to mirror. For example, if you set this value to 100, the first 100 bytes after the VXLAN header that meet the filter criteria are copied to the target.
To mirror the entire packet, do not enter a value in this field.
-
For Filter, choose the traffic mirror filter that determines what traffic gets mirrored.
-
-
(Optional) For each tag to add, choose Add new tag and enter the tag key and tag value.
-
Choose Create.
Step 4: Analyze the data
After the mirrored traffic is on the traffic mirror target, you can use a tool from the
AWS
Partner Network