traffic_mirror_sessions
Creates, updates, deletes or gets a traffic_mirror_session resource or lists traffic_mirror_sessions in a region
Overview
| Name | traffic_mirror_sessions |
| Type | Resource |
| Description | Resource schema for AWS::EC2::TrafficMirrorSession |
| Id | awscc.ec2.traffic_mirror_sessions |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
id | string | The ID of a Traffic Mirror session. |
network_interface_id | string | The ID of the source network interface. |
traffic_mirror_target_id | string | The ID of a Traffic Mirror target. |
traffic_mirror_filter_id | string | The ID of a Traffic Mirror filter. |
packet_length | integer | The number of bytes in each packet to mirror. |
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. |
virtual_network_id | integer | The VXLAN ID for the Traffic Mirror session. |
description | string | The description of the Traffic Mirror session. |
owner_id | string | The ID of the account that owns the Traffic Mirror session. |
tags | array | The tags assigned to the Traffic Mirror session. |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
id | string | The ID of a Traffic Mirror session. |
region | string | AWS region. |
For more information, see AWS::EC2::TrafficMirrorSession.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | traffic_mirror_sessions | INSERT | NetworkInterfaceId, TrafficMirrorFilterId, SessionNumber, TrafficMirrorTargetId, region |
delete_resource | traffic_mirror_sessions | DELETE | Identifier, region |
update_resource | traffic_mirror_sessions | UPDATE | Identifier, PatchDocument, region |
list_resources | traffic_mirror_sessions_list_only | SELECT | region |
get_resource | traffic_mirror_sessions | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual traffic_mirror_session.
SELECT
region,
id,
network_interface_id,
traffic_mirror_target_id,
traffic_mirror_filter_id,
packet_length,
session_number,
virtual_network_id,
description,
owner_id,
tags
FROM awscc.ec2.traffic_mirror_sessions
WHERE
region = '{{ region }}' AND
Identifier = '{{ id }}';
Lists all traffic_mirror_sessions in a region.
SELECT
region,
id
FROM awscc.ec2.traffic_mirror_sessions_list_only
WHERE
region = '{{ region }}';
INSERT example
Use the following StackQL query and manifest file to create a new traffic_mirror_session resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.ec2.traffic_mirror_sessions (
NetworkInterfaceId,
TrafficMirrorTargetId,
TrafficMirrorFilterId,
SessionNumber,
region
)
SELECT
'{{ network_interface_id }}',
'{{ traffic_mirror_target_id }}',
'{{ traffic_mirror_filter_id }}',
'{{ session_number }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
/*+ create */
INSERT INTO awscc.ec2.traffic_mirror_sessions (
NetworkInterfaceId,
TrafficMirrorTargetId,
TrafficMirrorFilterId,
PacketLength,
SessionNumber,
VirtualNetworkId,
Description,
OwnerId,
Tags,
region
)
SELECT
'{{ network_interface_id }}',
'{{ traffic_mirror_target_id }}',
'{{ traffic_mirror_filter_id }}',
'{{ packet_length }}',
'{{ session_number }}',
'{{ virtual_network_id }}',
'{{ description }}',
'{{ owner_id }}',
'{{ tags }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: traffic_mirror_session
props:
- name: network_interface_id
value: '{{ network_interface_id }}'
- name: traffic_mirror_target_id
value: '{{ traffic_mirror_target_id }}'
- name: traffic_mirror_filter_id
value: '{{ traffic_mirror_filter_id }}'
- name: packet_length
value: '{{ packet_length }}'
- name: session_number
value: '{{ session_number }}'
- name: virtual_network_id
value: '{{ virtual_network_id }}'
- name: description
value: '{{ description }}'
- name: owner_id
value: '{{ owner_id }}'
- name: tags
value:
- key: '{{ key }}'
value: '{{ value }}'
UPDATE example
Use the following StackQL query and manifest file to update a traffic_mirror_session resource, using stack-deploy.
/*+ update */
UPDATE awscc.ec2.traffic_mirror_sessions
SET PatchDocument = string('{{ {
"NetworkInterfaceId": network_interface_id,
"TrafficMirrorTargetId": traffic_mirror_target_id,
"TrafficMirrorFilterId": traffic_mirror_filter_id,
"PacketLength": packet_length,
"SessionNumber": session_number,
"VirtualNetworkId": virtual_network_id,
"Description": description,
"OwnerId": owner_id,
"Tags": tags
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ id }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
DELETE example
/*+ delete */
DELETE FROM awscc.ec2.traffic_mirror_sessions
WHERE
Identifier = '{{ id }}' AND
region = '{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
Additional Parameters
Mutable resources in the Cloud Control provider support additional optional parameters which can be supplied with INSERT, UPDATE, or DELETE operations. These include:
| Parameter | Description |
|---|---|
ClientToken | A unique identifier to ensure the idempotency of the resource request.This allows the provider to accurately distinguish between retries and new requests.A client token is valid for 36 hours once used. After that, a resource request with the same client token is treated as a new request. If you do not specify a client token, one is generated for inclusion in the request. |
RoleArn | The ARN of the IAM role used to perform this resource operation.The role specified must have the permissions required for this operation.If you do not specify a role, a temporary session is created using your AWS user credentials. |
TypeVersionId | For private resource types, the type version to use in this resource operation.If you do not specify a resource version, the default version is used. |
Permissions
To operate on the traffic_mirror_sessions resource, the following permissions are required:
- Create
- Read
- Update
- Delete
- List
ec2:CreateTrafficMirrorSession,
ec2:DescribeTrafficMirrorSessions,
ec2:CreateTags,
ec2:DescribeTags
ec2:DescribeTrafficMirrorSessions,
ec2:DescribeTags
ec2:ModifyTrafficMirrorSession,
ec2:CreateTags,
ec2:DeleteTags,
ec2:DescribeTrafficMirrorSessions,
ec2:DescribeTags
ec2:DeleteTrafficMirrorSession,
ec2:DeleteTags
ec2:DescribeTrafficMirrorSessions,
ec2:DescribeTags