What is AWS VPC Traffic Mirroring? The quick answer
AWS VPC Traffic Mirroring is an out-of-band packet-copying feature for Amazon VPC. It mirrors traffic from supported source network interfaces, applies ingress and egress filter rules, encapsulates accepted packets in VXLAN, and sends them to a traffic mirror target for analysis.
| Question | Answer |
|---|---|
| What does AWS copy? | Packets that match the traffic mirror filter on a supported source ENI. |
| How are copies transported? | VXLAN encapsulation; AWS documents destination UDP port 4789. |
| Where can copies go? | A network interface, Network Load Balancer, or Gateway Load Balancer endpoint. |
| Does mirroring block attacks? | No. It is a visibility mechanism. Prevention requires a separate enforcement point. |
| Does it decrypt TLS? | No. Mirroring copies packets; application payload visibility still depends on where encryption terminates. |
AWS describes Traffic Mirroring as a feature for copying network traffic from network interfaces attached to instances and delivering matching traffic to monitoring appliances. For a concise AWS overview, see How Traffic Mirroring works.
Source, target, filter and session: the four components
The feature becomes easier to design when you separate it into four objects. A common configuration error is to focus on the target appliance before confirming that the correct ENI and filter actually cover the traffic you need.
| Component | What it does | Practical check |
|---|---|---|
| Traffic mirror source | The supported network interface whose traffic can be copied. | Confirm this ENI actually sees the desired client, service, or database flow. |
| Traffic mirror target | The destination that receives mirrored traffic. | Choose ENI for simple designs, or NLB/GWLB endpoint when availability and scale matter. |
| Traffic mirror filter | Ordered ingress and egress accept/reject rules that decide what is copied. | Verify both directions. No matching rule means the packet is not mirrored. |
| Traffic mirror session | Links source, target and filter, with a session number plus optional VNI and packet length. | Check priority if one source has multiple sessions. |
Traffic Mirroring is not available on every EC2 instance type. AWS maintains the current supported-source list in its traffic mirror session concepts documentation. Check the source instance type before designing a rollout around a particular ENI.
How VXLAN works in AWS VPC Traffic Mirroring
After the filter accepts a packet, AWS wraps the mirrored copy in a VXLAN header and routes it to the configured target. The original production packet continues on its normal path; the monitoring copy follows the mirror path.
Production path Client -------- original packet --------> Application Mirror path Source ENI -> filter match -> VXLAN encapsulation -> UDP destination port 4789 -> traffic mirror target -> monitoring / security appliance -> original inner packet is analyzed
What is inside the mirrored packet?
AWS documents the traffic mirror packet with a VXLAN ID (VNI), an outer source IP, an outer source port derived from a hash of the original flow, a target destination IP, and destination port 4789. The appliance must remove the VXLAN wrapper before analyzing the original inner packet.
| Field | AWS behavior | Why it matters |
|---|---|---|
| VXLAN ID (VNI) | You can supply one for the session; otherwise AWS assigns a value. | Useful for identifying mirror-session context at the receiver. |
| Outer source IP | Primary IP of the source network interface. | Helps identify the mirrored workload path. |
| Outer source port | Derived from a flow hash. | Do not assume a fixed source port. |
| Outer destination port | UDP 4789. | The target path and security controls must allow it. |
GWLB has an important double-encapsulation detail
When mirrored traffic reaches an appliance through a Gateway Load Balancer, AWS documents an outer GENEVE encapsulation from GWLB and an inner VXLAN encapsulation from Traffic Mirroring. The receiving appliance must understand both layers to recover the original packet. This is easy to miss when a tool works with a direct ENI target but fails after moving behind GWLB.
See AWS's current traffic mirror packet format documentation and RFC 7348 for the VXLAN protocol.
Choose the right traffic mirror target architecture
AWS supports three target types: a network interface, a Network Load Balancer, and a Gateway Load Balancer endpoint. AWS specifically recommends NLB or a GWLB endpoint when high availability is required.
| Target pattern | Best fit | Operational trade-off |
|---|---|---|
| Network interface | Lab, PoC, focused capture, or a simple single-appliance design. | Easy to understand but the appliance design must handle availability and capacity. |
| Network Load Balancer | Multiple monitoring appliances that need load distribution. | NLB requires the appropriate UDP listener and adds load-balancer processing considerations. |
| Gateway Load Balancer endpoint | Centralized security-appliance architectures and shared-services patterns. | The appliance must handle GWLB GENEVE plus inner Traffic Mirroring VXLAN. |
Same VPC, cross-VPC and cross-account designs
The source and target can be in the same VPC. AWS also supports connected VPC designs using intra-Region VPC peering, Transit Gateway, or Gateway Load Balancer endpoint connectivity. Traffic mirror targets can also be shared across accounts. The mirror path still depends on route tables and network controls, so "the target exists" is not enough—the source must have a valid route to it.
For topology details, use AWS's source and target connectivity options and traffic mirror target concepts.
How to deploy AWS VPC Traffic Mirroring step by step
A reliable rollout starts with the visibility requirement, not with a blanket "mirror everything" configuration. Use a small known traffic set first, prove packet delivery and parsing, and only then expand coverage.
- Identify the traffic you need. Write down the source workload, protocol, direction, ports, expected request/response path, and whether the payload is encrypted at the candidate ENI.
- Verify the source is supported. Confirm the source network interface and instance type can be used for Traffic Mirroring.
- Create the target. Choose a monitoring ENI, NLB, or GWLB endpoint based on availability and scale.
- Make the target reachable. Validate routing and allow VXLAN UDP 4789 on the destination path as required.
- Create the filter. Add explicit ingress and egress rules for the traffic you intend to mirror.
- Create the session. Select the source, target, filter and priority. Configure VNI or packet length only when you have a reason.
- Generate known test traffic. Use a controlled request whose source, destination, protocol and timestamp are known.
- Validate at the receiver. Confirm VXLAN arrives, decapsulation works, the inner packet is present, and both directions are visible when required.
- Watch for packet loss and capacity limits. Test realistic peak traffic before expanding the mirrored scope.
- Document cost and data handling. Mirrored packets may contain credentials, tokens, personal data or regulated information.
AWS CLI session example
The following is a safe skeleton based on the current AWS CLI v2 command. Replace the example IDs with resources from your environment:
aws ec2 create-traffic-mirror-session \ --network-interface-id eni-SOURCE \ --traffic-mirror-target-id tmt-TARGET \ --traffic-mirror-filter-id tmf-FILTER \ --session-number 1 \ --description "Security monitoring"
Omit --packet-length when you want the full packet. If you set a packet length, AWS mirrors only that number of bytes after the VXLAN header. For the complete syntax, see the AWS CLI v2 create-traffic-mirror-session reference.
Filter and session behavior that often causes mistakes
Filter rules are ordered and directional
A traffic mirror filter has separate inbound and outbound rules. AWS evaluates rules from the lowest rule number upward, and the first matching rule decides whether the packet is accepted or rejected for mirroring. If you do not add outbound rules, outbound traffic is not mirrored. A filter with no applicable rules does not magically capture everything.
Session number is a priority, not just a label
When the same source interface has multiple traffic mirror sessions, AWS evaluates them in ascending session-number order. Valid session numbers are 1 through 32,766, with 1 as the highest priority. AWS states that each packet is mirrored once, so the first session with a matching filter determines where that packet is mirrored.
Packet truncation can remove the context you care about
Packet length can reduce mirrored volume, but it can also remove application data from the copied packet. AWS notes that truncation can affect checksum calculation on the mirrored packet. For API security, forensics, or protocol analysis, decide the packet length from the evidence you actually need—not from a generic "smaller is faster" assumption.
See AWS's traffic mirror filter concepts and session configuration documentation.
Current limits, packet-loss behavior and cost considerations
Traffic Mirroring is not an unlimited copy of every packet. Capacity and quota behavior should be part of the design review, especially when a single target collects traffic from many high-volume workloads.
| Current AWS quota / behavior | Documented value or rule | Design implication |
|---|---|---|
| Sessions per account | 10,000 | Large estates still need naming, ownership and lifecycle controls. |
| Sessions per source network interface | 3 | Plan session priorities and tool fan-out carefully. |
| Filter rules per filter | 10 | Use focused rules rather than trying to encode an entire firewall policy. |
| Sources per network-interface target | 100 or 10 depending on the target instance type; AWS lists no source limit for NLB or GWLB endpoint targets | Receiver sizing and target architecture matter. |
| GWLB endpoint throughput | 100 Gbps maximum per endpoint | Centralized architectures need a realistic capacity model. |
These are the values in the AWS Traffic Mirroring quota documentation at the time of this update; always verify the current AWS page before a production design because service limits can change. See Traffic Mirroring quotas.
Mirrored packets can be dropped under pressure
AWS documents that if traffic exceeds an instance's bandwidth or packets-per-second limits, mirrored traffic is dropped before production traffic. Small average packet sizes can also cause mirrored traffic to be dropped at lower bandwidth levels. That means "the session is configured" is not the same as "the monitoring tool sees every production packet."
Monitor capture loss, receiver CPU, queue pressure and packet rates. For incident response or compliance use cases, document whether packet loss is acceptable and how you will detect it. AWS's current limitations are described in Traffic Mirroring limitations.
Traffic Mirroring has direct and indirect costs
AWS charges for active traffic mirror sessions. Data transfer charges can apply, and when targets sit behind Network Load Balancer or Gateway Load Balancer, related load-balancer data-processing charges can also apply. AWS also notes that session charges continue until active mirror sessions are deleted, including cases where the source interface is detached or the source instance is stopped or terminated. Cost therefore depends on both session lifecycle and the architecture carrying mirrored traffic.
What VPC Traffic Mirroring can—and cannot—provide for API security
Traffic Mirroring can be a useful acquisition method for monitoring-first API security because it observes production traffic without adding a new inline hop. The security value, however, depends on what is visible at the selected ENI and what the receiving tool can reconstruct.
| API security need | Mirroring can help when… | Key limitation to validate |
|---|---|---|
| API discovery | Paths, hosts, methods and message patterns are observable. | Encrypted or incomplete traffic can hide endpoint detail. |
| Request inspection | The capture point exposes relevant headers, parameters and bodies. | TLS is not decrypted by Traffic Mirroring itself. |
| Response inspection | Egress/response traffic is also mirrored and the payload is visible. | Request-only capture misses data exposure and response behavior. |
| Behavior analytics | The tool can correlate endpoints, clients, identities and sequences over time. | Packet visibility alone may not contain user or business identity. |
| Active blocking | Findings are sent to a separate gateway, WAF, application or inline control. | Traffic Mirroring is not itself an enforcement point. |
Where to capture encrypted API traffic
Do not assume a mirrored HTTPS flow provides readable API bodies. Identify where TLS terminates, whether traffic is re-encrypted, and which ENI sees the request in a form useful to the monitoring tool. If the required payload remains encrypted, combine mirroring with gateway, reverse-proxy, application, service-mesh or other approved application-layer telemetry instead of weakening TLS.
Where Ammune fits
Ammune can use monitoring-first traffic visibility as one input for runtime API discovery and analysis. Where the selected traffic source provides sufficient application context, Ammune can help inventory APIs, inspect requests and responses, identify sensitive-data exposure and abnormal behavior, and forward security events into SOC/SIEM workflows. Where prevention is required, findings should be connected to an appropriate enforcement point or Ammune can be deployed in an inline architecture designed for blocking.
AWS VPC Traffic Mirroring troubleshooting: follow the packet
Troubleshooting is faster when you work from the source outward. A healthy session object does not prove that a packet matches the filter, reaches the target, is decapsulated, or survives receiver overload.
| Symptom | What to check first | Common cause |
|---|---|---|
| No mirrored packets at all | Source ENI, filter rules, session status and session priority. | Wrong ENI, no matching accept rule, or another higher-priority session matched first. |
| Packets leave source but never reach appliance | Source route table, target route, security group, NACL and UDP 4789 path. | Mirror target is not reachable or VXLAN traffic is blocked. |
| VXLAN arrives but tool shows no inner traffic | Decapsulation capability and target mode. | Tool is not parsing VXLAN; GWLB designs may also require GENEVE decapsulation. |
| Requests visible but responses missing | Outbound filter rules and capture point. | Only ingress rules were configured or response path uses another ENI. |
| API payload unreadable | TLS termination and re-encryption path. | The mirrored packet is still encrypted. |
| Intermittent gaps under load | Source bandwidth/PPS, target capacity, capture drops and packet size. | Mirrored traffic is being dropped under resource pressure. |
| Packet parser reports checksum errors | Packet-length truncation and checksum offload behavior. | Truncated mirrored packets may not have recalculated checksums. |
A simple validation sequence
1. Generate one known test request. 2. Confirm it traverses the intended source ENI. 3. Confirm the filter should accept that direction/protocol/port/CIDR. 4. Confirm this session has the expected priority. 5. Confirm UDP 4789 reaches the target. 6. Confirm the receiver can decode VXLAN. 7. If using GWLB, confirm GENEVE + inner VXLAN parsing. 8. Confirm the original inner packet is visible. 9. Repeat for the response direction. 10. Repeat under realistic load and watch for packet loss.
When should you use VPC Traffic Mirroring?
Traffic Mirroring is a strong fit when packet-level observation is valuable and you want the monitoring system out of the application forwarding path. It is less suitable when the use case requires guaranteed payload decryption, application identity that packets do not contain, or immediate inline blocking.
Good fit
Network forensics, IDS/NDR, troubleshooting, observability, traffic analysis, monitoring-first security, and controlled packet capture.
Needs another data source
Encrypted API payload analysis, application-user identity, business transaction context, traces, or deep service-mesh context.
Needs an enforcement point
Blocking malicious requests, rate limiting, authorization enforcement, WAF policy, challenge/response, or inline API protection.
Needs capacity planning
High-volume workloads, many source ENIs, packet-retention workflows, centralized appliances, or heavy SIEM ingestion.
Production-readiness checklist
- Confirm the source ENI and instance type support Traffic Mirroring.
- Map the real request and response path before selecting the source.
- Choose ENI, NLB, or GWLB endpoint target based on HA and scale requirements.
- Confirm a valid route from the source VPC to the target.
- Allow required VXLAN UDP 4789 traffic on the target path.
- Define explicit inbound and outbound filter rules.
- Review session-number priority if a source has more than one session.
- Use full packets unless truncation has a documented reason and has been tested.
- Validate VXLAN decapsulation; validate GENEVE + VXLAN for GWLB designs.
- Test TLS visibility at the chosen capture point.
- Measure packet loss under expected peak traffic.
- Protect mirrored data with access, retention, masking and storage controls appropriate to its sensitivity.
- Monitor active-session cost, data transfer, load-balancer processing, receiver compute and downstream storage/SIEM costs.
- Tag sessions, filters and targets with environment, owner and purpose.
- Revalidate the design after major routing, encryption, instance-type or application changes.
Primary references used for this guide
This article was reviewed against current AWS and protocol documentation rather than relying on secondary summaries.
- AWS: How Traffic Mirroring works
- AWS: Traffic mirror packet format
- AWS: Traffic mirror target concepts
- AWS: Traffic mirror filter concepts
- AWS: Traffic mirror session concepts
- AWS: Source and target connectivity
- AWS: Traffic Mirroring limitations
- AWS: Traffic Mirroring quotas
- RFC 7348: Virtual eXtensible Local Area Network (VXLAN)
Frequently asked questions
What port does AWS VPC Traffic Mirroring use for VXLAN?
AWS documents UDP destination port 4789 for the VXLAN-encapsulated mirror packet. The path to the target must allow the required traffic.
Does VPC Traffic Mirroring copy both inbound and outbound traffic?
It can, but the filter rules are directional. Configure and validate both inbound and outbound rules when your use case requires both directions.
Can a Network Load Balancer be a traffic mirror target?
Yes. AWS supports network interfaces, Network Load Balancers, and Gateway Load Balancer endpoints as traffic mirror targets. AWS recommends NLB or GWLB endpoint targets for high-availability designs.
Can VPC Traffic Mirroring decrypt HTTPS traffic?
No. Traffic Mirroring copies packets and does not decrypt TLS by itself. For API payload analysis, choose a visibility point where the required application data is available or combine mirroring with approved application-layer telemetry.
How many traffic mirror sessions can one source ENI have?
AWS currently documents a maximum of three sessions per source network interface. Session priority matters because packets are evaluated by ascending session number and each packet is mirrored once.
What happens if I do not set packet length?
AWS documents that omitting packet length mirrors the entire packet. Setting packet length copies only that number of bytes after the VXLAN header.
Why am I seeing requests but not responses?
Check outbound filter rules, session priority, and whether the response uses the same source ENI. If no outbound rules match, outbound traffic is not mirrored.
Can traffic mirror sources and targets be in different VPCs?
Yes, when the VPCs are connected through supported intra-Region connectivity such as VPC peering, Transit Gateway, or a Gateway Load Balancer endpoint design. Routing and network controls must still permit the mirror path.
Can mirrored traffic be dropped?
Yes. AWS documents that mirrored traffic can be dropped when instance bandwidth or packet-per-second limits are exceeded, with production traffic receiving priority. Monitoring packet loss is important in high-volume designs.
Does Traffic Mirroring block malicious API requests?
No. It is an out-of-band visibility mechanism. Active prevention requires a gateway, WAF, application control, firewall, proxy, or another inline enforcement point.
Conclusion
AWS VPC Traffic Mirroring is most useful when treated as a packet-visibility building block rather than as a complete security control. The source ENI determines what can be observed, the filter determines what is copied, the session determines priority and transport settings, and the target architecture determines how reliably the monitoring system can receive and process the data.
For a production deployment, pay particular attention to UDP 4789 reachability, VXLAN parsing, GWLB double encapsulation, request/response coverage, TLS visibility, packet truncation, current AWS quotas, packet-loss behavior, and the full cost of collecting and retaining mirrored traffic.
Turn mirrored AWS traffic into useful API security evidence
If your goal is API discovery, runtime behavior monitoring, sensitive-data visibility, or SIEM-ready investigation, evaluate the capture point first. Ammune can help map the traffic source to the API-security outcomes you need and identify where monitoring or inline protection fits.
