Traffic mirror sessions
A traffic mirror session establishes a relationship between a traffic mirror source and a traffic mirror target. A traffic mirror session contains the following resources:
The source is the network interface of type interface
(for example, the
network interface for an EC2 instance or an RDS instance). For more information, see
Traffic Mirroring limitations and quotas.
Each packet is mirrored once. However, you can use multiple traffic mirror sessions on the same source. This is useful if you want to send a subset of the mirrored traffic from a traffic mirror source to multiple tools. For example, you can filter HTTP traffic in a higher priority traffic mirror session and send it to a specific monitoring appliance. At the same time, you can filter all other TCP traffic in a lower priority traffic mirror session and send it to another monitoring appliance.
Traffic mirror sessions are evaluated based on the ascending priority that you define when you create the session.
Create a traffic mirror session
Create a traffic mirror session.
Before you create a traffic mirror session, make sure that you have the following information:
-
The network interface for the source. The network interface type must be
instance
. -
The traffic mirror target
-
To use a target in your account, see Create a traffic mirror target.
-
To use a target that is owned by another account and shared with you, accept the shared resource before you create the traffic mirror session. For more information, see Accept a resource share.
-
-
The traffic mirror filter (for more information, see Create a traffic mirror filter)
To create a traffic mirror session using the console
-
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.
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 or create one. For more information, see Create a 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 when an interface is used by multiple sessions that have the same interface, but have 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 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.
To create a filter, choose Create filter. For more information, see Step 2: Create the traffic mirror filter.
-
-
(Optional) For each tag to add, choose Add new tag and enter the tag key and tag value.
-
Choose Create.
To create a traffic mirror session using the AWS CLI
Use the create-traffic-mirror-session command.
View your traffic mirror sessions
To view your traffic mirror sessions using the console
-
Open the Amazon VPC console at https://console.aws.amazon.com/vpc/
. -
In the navigation pane, choose Traffic Mirroring, Mirror Sessions.
-
Select the ID of the traffic mirror session to open its details page.
To view your traffic mirror session using the AWS CLI
Use the describe-traffic-mirror-sessions command.
Modify your traffic mirror session
To modify your traffic mirror session using the console
-
Open the Amazon VPC console at https://console.aws.amazon.com/vpc/
. -
In the navigation pane, choose Traffic Mirroring, Mirror Sessions.
-
Select the traffic mirror session.
-
Choose Actions, Modify session.
-
(Optional) For Description, enter a description for the traffic mirror session.
-
For Mirror target, choose the traffic mirror target.
To create a target, choose Create target. For more information, see Create a traffic mirror target.
-
For Additional settings, do the following:
-
For Session number, enter the session number. The session number determines the order that traffic mirror sessions are evaluated. The valid values are 1 to 32,766, where 1 is the highest priority.
-
(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.
-
-
Choose Modify.
To modify your traffic mirror session using the AWS CLI
Use the modify-traffic-mirror-session command.
Modify traffic mirror session tags
To modify your traffic mirror session tags using the console
-
Open the Amazon VPC console at https://console.aws.amazon.com/vpc/
. -
In the navigation pane, choose Traffic Mirroring, Mirror Sessions.
-
Select the ID of the traffic mirror session to open its details page.
-
On the Tags tab, choose Manage tags.
-
(Optional) For each tag to add, choose Add new tag and enter the tag key and tag value. For each tag to remove, choose Remove.
-
Choose Modify.
To modify your traffic mirror session using the AWS CLI
Use the create-tags command to add a tag. Use the delete-tags command to remove a tag.
Delete a traffic mirror session
To delete your traffic mirror session using the console
-
Open the Amazon VPC console at https://console.aws.amazon.com/vpc/
. -
On the navigation pane, choose Traffic Mirroring, Mirror Sessions.
-
Select the traffic mirror session, and then choose Actions, Delete.
-
When prompted for confirmation, enter
delete
, and then choose Delete.
To delete a traffic mirror session using the AWS CLI
Use the delete-traffic-mirror-session command.