traffic_mirror_sessions
Creates, updates, deletes, gets or lists a traffic_mirror_sessions resource.
Overview
| Name | traffic_mirror_sessions |
| Type | Resource |
| Id | aws.ec2.traffic_mirror_sessions |
Fields
The following fields are returned by SELECT queries:
- describe_traffic_mirror_sessions
| Name | Datatype | Description |
|---|---|---|
description | string | The description of the Traffic Mirror session. |
network_interface_id | string | The ID of the Traffic Mirror session's network interface. |
owner_id | string | The ID of the account that owns the Traffic Mirror session. |
packet_length | integer | The 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_number | integer | The 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. |
tags | string | The tags assigned to the Traffic Mirror session. |
traffic_mirror_filter_id | string | The ID of the Traffic Mirror filter. |
traffic_mirror_session_id | string | The ID for the Traffic Mirror session. |
traffic_mirror_target_id | string | The ID of the Traffic Mirror target. |
virtual_network_id | integer | The virtual network ID associated with the Traffic Mirror session. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
describe_traffic_mirror_sessions | select | region | TrafficMirrorSessionId, DryRun, Filter, MaxResults, NextToken | Describes one or more Traffic Mirror sessions. By default, all Traffic Mirror sessions are described. Alternatively, you can filter the results. |
create_traffic_mirror_session | insert | NetworkInterfaceId, TrafficMirrorTargetId, TrafficMirrorFilterId, SessionNumber, region | PacketLength, VirtualNetworkId, Description, TagSpecification, DryRun, ClientToken | 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. |
modify_traffic_mirror_session | update | TrafficMirrorSessionId, region | TrafficMirrorTargetId, TrafficMirrorFilterId, PacketLength, SessionNumber, VirtualNetworkId, Description, RemoveField, DryRun | Modifies a Traffic Mirror session. |
delete_traffic_mirror_session | delete | TrafficMirrorSessionId, region | DryRun | Deletes 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.
| Name | Datatype | Description |
|---|---|---|
NetworkInterfaceId | string | The ID of the source network interface. |
SessionNumber | integer | The 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. |
TrafficMirrorFilterId | string | The ID of the Traffic Mirror filter. |
TrafficMirrorSessionId | string | The ID of the Traffic Mirror session. |
TrafficMirrorTargetId | string | The ID of the Traffic Mirror target. |
region | string | AWS region (default: us-east-1) |
ClientToken | string | Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see How to ensure idempotency. |
Description | string | The description to assign to the Traffic Mirror session. |
DryRun | boolean | Checks 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. |
Filter | array | One 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. |
MaxResults | integer | The maximum number of results to return with a single call. To retrieve the remaining results, make another call with the returned nextToken value. |
NextToken | string | The token for the next page of results. |
PacketLength | integer | The 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. |
RemoveField | array | The 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. |
SessionNumber | integer | The 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. |
TagSpecification | array | The tags to assign to a Traffic Mirror session. |
TrafficMirrorFilterId | string | The ID of the Traffic Mirror filter. |
TrafficMirrorSessionId | array | The ID of the Traffic Mirror session. |
TrafficMirrorTargetId | string | The Traffic Mirror target. The target must be in the same VPC as the source, or have a VPC peering connection with the source. |
VirtualNetworkId | integer | The virtual network ID of the Traffic Mirror session. |
SELECT examples
- describe_traffic_mirror_sessions
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
- create_traffic_mirror_session
- Manifest
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
;
# Description fields are for documentation purposes
- name: traffic_mirror_sessions
props:
- name: NetworkInterfaceId
value: "{{ NetworkInterfaceId }}"
description: Required parameter for the traffic_mirror_sessions resource.
- name: TrafficMirrorTargetId
value: "{{ TrafficMirrorTargetId }}"
description: Required parameter for the traffic_mirror_sessions resource.
- name: TrafficMirrorFilterId
value: "{{ TrafficMirrorFilterId }}"
description: Required parameter for the traffic_mirror_sessions resource.
- name: SessionNumber
value: {{ SessionNumber }}
description: Required parameter for the traffic_mirror_sessions resource.
- name: region
value: "{{ region }}"
description: Required parameter for the traffic_mirror_sessions resource.
- name: PacketLength
value: {{ PacketLength }}
description: The number of bytes in each packet to mirror. These are bytes after the VXLAN header. Do not specify this parameter when you want to mirror the entire packet. To mirror a subset of the packet, set this to the length (in bytes) that you want 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. If you do not want to mirror the entire packet, use the PacketLength parameter to specify the number of bytes in each packet to mirror. 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.
description: The number of bytes in each packet to mirror. These are bytes after the VXLAN header. Do not specify this parameter when you want to mirror the entire packet. To mirror a subset of the packet, set this to the length (in bytes) that you want 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. If you do not want to mirror the entire packet, use the PacketLength parameter to specify the number of bytes in each packet to mirror. 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.
- name: VirtualNetworkId
value: {{ VirtualNetworkId }}
description: The VXLAN ID for the Traffic Mirror session. For more information about the VXLAN protocol, see RFC 7348. If you do not specify a VirtualNetworkId, an account-wide unique ID is chosen at random.
description: The VXLAN ID for the Traffic Mirror session. For more information about the VXLAN protocol, see RFC 7348. If you do not specify a VirtualNetworkId, an account-wide unique ID is chosen at random.
- name: Description
value: "{{ Description }}"
description: The description of the Traffic Mirror session.
description: The description of the Traffic Mirror session.
- name: TagSpecification
value: "{{ TagSpecification }}"
description: The tags to assign to a Traffic Mirror session.
description: The tags to assign to a Traffic Mirror session.
- name: DryRun
value: {{ DryRun }}
description: Checks 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.
description: Checks 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.
- name: ClientToken
value: "{{ ClientToken }}"
description: Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see How to ensure idempotency.
description: Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see How to ensure idempotency.
UPDATE examples
- modify_traffic_mirror_session
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
- delete_traffic_mirror_session
Deletes the specified Traffic Mirror session.
DELETE FROM aws.ec2.traffic_mirror_sessions
WHERE TrafficMirrorSessionId = '{{ TrafficMirrorSessionId }}' --required
AND region = '{{ region }}' --required
AND DryRun = '{{ DryRun }}'
;