DescribeTrafficMirrorSessionsCommand

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

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { EC2Client, DescribeTrafficMirrorSessionsCommand } from "@aws-sdk/client-ec2"; // ES Modules import
// const { EC2Client, DescribeTrafficMirrorSessionsCommand } = require("@aws-sdk/client-ec2"); // CommonJS import
const client = new EC2Client(config);
const input = { // DescribeTrafficMirrorSessionsRequest
  TrafficMirrorSessionIds: [ // TrafficMirrorSessionIdList
    "STRING_VALUE",
  ],
  DryRun: true || false,
  Filters: [ // FilterList
    { // Filter
      Name: "STRING_VALUE",
      Values: [ // ValueStringList
        "STRING_VALUE",
      ],
    },
  ],
  MaxResults: Number("int"),
  NextToken: "STRING_VALUE",
};
const command = new DescribeTrafficMirrorSessionsCommand(input);
const response = await client.send(command);
// { // DescribeTrafficMirrorSessionsResult
//   TrafficMirrorSessions: [ // TrafficMirrorSessionSet
//     { // TrafficMirrorSession
//       TrafficMirrorSessionId: "STRING_VALUE",
//       TrafficMirrorTargetId: "STRING_VALUE",
//       TrafficMirrorFilterId: "STRING_VALUE",
//       NetworkInterfaceId: "STRING_VALUE",
//       OwnerId: "STRING_VALUE",
//       PacketLength: Number("int"),
//       SessionNumber: Number("int"),
//       VirtualNetworkId: Number("int"),
//       Description: "STRING_VALUE",
//       Tags: [ // TagList
//         { // Tag
//           Key: "STRING_VALUE",
//           Value: "STRING_VALUE",
//         },
//       ],
//     },
//   ],
//   NextToken: "STRING_VALUE",
// };

DescribeTrafficMirrorSessionsCommand Input

Parameter
Type
Description
DryRun
boolean | undefined

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.

Filters
Filter[] | undefined

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
number | undefined

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 | undefined

The token for the next page of results.

TrafficMirrorSessionIds
string[] | undefined

The ID of the Traffic Mirror session.

DescribeTrafficMirrorSessionsCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
NextToken
string | undefined

The token to use to retrieve the next page of results. The value is null when there are no more results to return.

TrafficMirrorSessions
TrafficMirrorSession[] | undefined

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

Throws

Name
Fault
Details
EC2ServiceException
Base exception class for all service exceptions from EC2 service.