How Do You Detect Unsolicited Inbound Traffic in NAT Gateway Flow Logs?
A company has VPC flow logs enabled for Its NAT gateway. The company is seeing Action = ACCEPT for inbound traffic that comes from public IP address 198.51.100.2 destined for a private Amazon EC2 instance. A solutions architect must determine whether the traffic represents unsolicited inbound connections from the internet. The first two octets of the VPC CIDR block are 203.0. Which set of steps should the solutions architect take to meet these requirements?
Community Insight
Testing whether NAT gateway inbound traffic is unsolicited requires finding the corresponding outbound flow from the VPC CIDR to the public IP; the trap is re-querying the already-visible inbound record (option B) or using CloudTrail instead of CloudWatch Logs.
VPC Flow Logs for a NAT gateway are analyzed in Amazon CloudWatch Logs, not CloudTrail, to determine whether inbound traffic from 198.51.100.2 was solicited. The page establishes that option D is correct because it queries the reverse flow from the 203.0 VPC CIDR back to the public IP to see whether the instance initiated the connection.
The most common wrong choice is B: it opens CloudWatch and filters on the exact inbound tuple already observed, but that only restates the suspicious traffic and cannot prove whether the VPC contacted 198.51.100.2 first.
Community Discussion (77 comments)
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
Expert Analysis
Why the Answer Is Correct
Option D is the only choice that both uses the correct log destination and checks the direction needed to answer the question. VPC Flow Logs are stored in Amazon CloudWatch Logs, so the architect should open the CloudWatch console, select the log group for the NAT gateway ENI and the private EC2 ENI, and query for dstAddr like 198.51.100.2 with srcAddr like 203.0. If that reverse flow exists before the inbound ACCEPT record, the traffic is a response to an outbound connection initiated by the VPC; if it does not exist, the inbound connection is more likely unsolicited. The stats command summing bytes by srcAddr and dstAddr is the documented way to compare the two directions.Why the Other Options Are Wrong
Options A and C send the architect to AWS CloudTrail, which records API activity and cannot contain NAT gateway packet-flow records; that alone eliminates them. Options B and D correctly use CloudWatch, but B filters with destination 203.0 and source 198.51.100.2, which is the same inbound record the company already sees. B can confirm that the traffic exists, but it cannot show whether the VPC contacted 198.51.100.2 first, so it does not resolve the "unsolicited" question. C also reverses the useful direction and uses CloudTrail.Community Comment Notes
Several learners were split between B and D. Maria2023 initially chose B but changed to D because the word "unsolicited" requires checking "if it's a return traffic, requested by a machine in the VPC"; cox1960 made the same point, saying B is what the company already sees and D is needed "to see if it was first initiated from EC2". johnballs221 similarly said the goal is to check whether the inbound flow is a response to an outbound connection. The B-leaning comments, such as kiran15789's query using dstAddr like the VPC prefix and srcAddr like the public IP, describe the visible inbound record but do not establish whether the connection was solicited.Official Reference
Exam Strategy
Eliminate CloudTrail immediately whenever the stem asks about VPC Flow Logs or packet-level traffic, because CloudTrail records AWS API calls, not flow records. Then decide which direction of the flow proves the point: for unsolicited inbound, look for the VPC-initiated outbound flow, not the inbound record that prompted the investigation.
Frequently Asked Questions
Why is CloudTrail wrong for analyzing NAT gateway flow logs?
VPC Flow Logs are delivered to CloudWatch Logs (or S3/Firehose), not CloudTrail, which records AWS API activity rather than packet flows.
Why query dstAddr like 198.51.100.2 instead of the inbound record already seen?
The visible inbound record only shows the public IP sending traffic; the reverse flow with dstAddr 198.51.100.2 and srcAddr 203.0 shows whether the EC2 instance initiated the connection first.
Related Analysis
Practice All SAP-C02 Questions
Access 85 questions with complete answers and detailed explanations.
View Full SAP-C02 Practice Test →