Skip to main content

traffic_mirror_sessions

Creates, updates, deletes, gets or lists a traffic_mirror_sessions resource.

Overview

Nametraffic_mirror_sessions
TypeResource
Idaws.ec2.traffic_mirror_sessions

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
descriptionstringThe description of the Traffic Mirror session.
network_interface_idstringThe ID of the Traffic Mirror session's network interface.
owner_idstringThe ID of the account that owns the Traffic Mirror session.
packet_lengthintegerThe number of bytes in each packet to mirror. These are the bytes after the VXLAN header. To mirror a subset, set this to the length (in bytes) to mirror. For example, if you set this value to 100, then the first 100 bytes that meet the filter criteria are copied to the target. Do not specify this parameter when you want to mirror the entire packet
session_numberintegerThe session number determines the order in which sessions are evaluated when an interface is used by multiple sessions. The first session with a matching filter is the one that mirrors the packets. Valid values are 1-32766.
tagsstringThe tags assigned to the Traffic Mirror session.
traffic_mirror_filter_idstringThe ID of the Traffic Mirror filter.
traffic_mirror_session_idstringThe ID for the Traffic Mirror session.
traffic_mirror_target_idstringThe ID of the Traffic Mirror target.
virtual_network_idintegerThe virtual network ID associated with the Traffic Mirror session.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_traffic_mirror_sessionsselectregionTrafficMirrorSessionId, DryRun, Filter, MaxResults, NextTokenDescribes one or more Traffic Mirror sessions. By default, all Traffic Mirror sessions are described. Alternatively, you can filter the results.
create_traffic_mirror_sessioninsertNetworkInterfaceId, TrafficMirrorTargetId, TrafficMirrorFilterId, SessionNumber, regionPacketLength, VirtualNetworkId, Description, TagSpecification, DryRun, ClientTokenCreates a Traffic Mirror session. A Traffic Mirror session actively copies packets from a Traffic Mirror source to a Traffic Mirror target. Create a filter, and then assign it to the session to define a subset of the traffic to mirror, for example all TCP traffic. The Traffic Mirror source and the Traffic Mirror target (monitoring appliances) can be in the same VPC, or in a different VPC connected via VPC peering or a transit gateway. By default, no traffic is mirrored. Use CreateTrafficMirrorFilter to create filter rules that specify the traffic to mirror.
modify_traffic_mirror_sessionupdateTrafficMirrorSessionId, regionTrafficMirrorTargetId, TrafficMirrorFilterId, PacketLength, SessionNumber, VirtualNetworkId, Description, RemoveField, DryRunModifies a Traffic Mirror session.
delete_traffic_mirror_sessiondeleteTrafficMirrorSessionId, regionDryRunDeletes the specified Traffic Mirror session.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
NetworkInterfaceIdstringThe ID of the source network interface.
SessionNumberintegerThe session number determines the order in which sessions are evaluated when an interface is used by multiple sessions. The first session with a matching filter is the one that mirrors the packets. Valid values are 1-32766.
TrafficMirrorFilterIdstringThe ID of the Traffic Mirror filter.
TrafficMirrorSessionIdstringThe ID of the Traffic Mirror session.
TrafficMirrorTargetIdstringThe ID of the Traffic Mirror target.
regionstringAWS region (default: us-east-1)
ClientTokenstringUnique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see How to ensure idempotency.
DescriptionstringThe description to assign to the Traffic Mirror session.
DryRunbooleanChecks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.
FilterarrayOne or more filters. The possible values are: description: The Traffic Mirror session description. network-interface-id: The ID of the Traffic Mirror session network interface. owner-id: The ID of the account that owns the Traffic Mirror session. packet-length: The assigned number of packets to mirror. session-number: The assigned session number. traffic-mirror-filter-id: The ID of the Traffic Mirror filter. traffic-mirror-session-id: The ID of the Traffic Mirror session. traffic-mirror-target-id: The ID of the Traffic Mirror target. virtual-network-id: The virtual network ID of the Traffic Mirror session.
MaxResultsintegerThe maximum number of results to return with a single call. To retrieve the remaining results, make another call with the returned nextToken value.
NextTokenstringThe token for the next page of results.
PacketLengthintegerThe number of bytes in each packet to mirror. These are bytes after the VXLAN header. To mirror a subset, set this to the length (in bytes) to mirror. For example, if you set this value to 100, then the first 100 bytes that meet the filter criteria are copied to the target. Do not specify this parameter when you want to mirror the entire packet. For sessions with Network Load Balancer (NLB) traffic mirror targets, the default PacketLength will be set to 8500. Valid values are 1-8500. Setting a PacketLength greater than 8500 will result in an error response.
RemoveFieldarrayThe properties that you want to remove from the Traffic Mirror session. When you remove a property from a Traffic Mirror session, the property is set to the default.
SessionNumberintegerThe session number determines the order in which sessions are evaluated when an interface is used by multiple sessions. The first session with a matching filter is the one that mirrors the packets. Valid values are 1-32766.
TagSpecificationarrayThe tags to assign to a Traffic Mirror session.
TrafficMirrorFilterIdstringThe ID of the Traffic Mirror filter.
TrafficMirrorSessionIdarrayThe ID of the Traffic Mirror session.
TrafficMirrorTargetIdstringThe Traffic Mirror target. The target must be in the same VPC as the source, or have a VPC peering connection with the source.
VirtualNetworkIdintegerThe virtual network ID of the Traffic Mirror session.

SELECT examples

Describes one or more Traffic Mirror sessions. By default, all Traffic Mirror sessions are described. Alternatively, you can filter the results.

SELECT
description,
network_interface_id,
owner_id,
packet_length,
session_number,
tags,
traffic_mirror_filter_id,
traffic_mirror_session_id,
traffic_mirror_target_id,
virtual_network_id
FROM aws.ec2.traffic_mirror_sessions
WHERE region = '{{ region }}' -- required
AND TrafficMirrorSessionId = '{{ TrafficMirrorSessionId }}'
AND DryRun = '{{ DryRun }}'
AND Filter = '{{ Filter }}'
AND MaxResults = '{{ MaxResults }}'
AND NextToken = '{{ NextToken }}'
;

INSERT examples

Creates a Traffic Mirror session. A Traffic Mirror session actively copies packets from a Traffic Mirror source to a Traffic Mirror target. Create a filter, and then assign it to the session to define a subset of the traffic to mirror, for example all TCP traffic. The Traffic Mirror source and the Traffic Mirror target (monitoring appliances) can be in the same VPC, or in a different VPC connected via VPC peering or a transit gateway. By default, no traffic is mirrored. Use CreateTrafficMirrorFilter to create filter rules that specify the traffic to mirror.

INSERT INTO aws.ec2.traffic_mirror_sessions (
NetworkInterfaceId,
TrafficMirrorTargetId,
TrafficMirrorFilterId,
SessionNumber,
region,
PacketLength,
VirtualNetworkId,
Description,
TagSpecification,
DryRun,
ClientToken
)
SELECT
'{{ NetworkInterfaceId }}',
'{{ TrafficMirrorTargetId }}',
'{{ TrafficMirrorFilterId }}',
'{{ SessionNumber }}',
'{{ region }}',
'{{ PacketLength }}',
'{{ VirtualNetworkId }}',
'{{ Description }}',
'{{ TagSpecification }}',
'{{ DryRun }}',
'{{ ClientToken }}'
RETURNING
description,
network_interface_id,
owner_id,
packet_length,
session_number,
tags,
traffic_mirror_filter_id,
traffic_mirror_session_id,
traffic_mirror_target_id,
virtual_network_id
;

UPDATE examples

Modifies a Traffic Mirror session.

UPDATE aws.ec2.traffic_mirror_sessions
SET
-- No updatable properties
WHERE
TrafficMirrorSessionId = '{{ TrafficMirrorSessionId }}' --required
AND region = '{{ region }}' --required
AND TrafficMirrorTargetId = '{{ TrafficMirrorTargetId}}'
AND TrafficMirrorFilterId = '{{ TrafficMirrorFilterId}}'
AND PacketLength = '{{ PacketLength}}'
AND SessionNumber = '{{ SessionNumber}}'
AND VirtualNetworkId = '{{ VirtualNetworkId}}'
AND Description = '{{ Description}}'
AND RemoveField = '{{ RemoveField}}'
AND DryRun = {{ DryRun}}
RETURNING
description,
network_interface_id,
owner_id,
packet_length,
session_number,
tags,
traffic_mirror_filter_id,
traffic_mirror_session_id,
traffic_mirror_target_id,
virtual_network_id;

DELETE examples

Deletes the specified Traffic Mirror session.

DELETE FROM aws.ec2.traffic_mirror_sessions
WHERE TrafficMirrorSessionId = '{{ TrafficMirrorSessionId }}' --required
AND region = '{{ region }}' --required
AND DryRun = '{{ DryRun }}'
;