Preventing Dropped TGW Traffic with Network ACLs and Lambda
A company has a transit gateway in a single AWS account. The company sends flow logs for the transit gateway to an Amazon CloudWatch Logs log group. The company created an AWS Lambda function to analyze the logs. The Lambda function sends a notification to an Amazon Simple Notification Service (Amazon SNS) topic when a VPC generates traffic that is dropped by the transit gateway. Each notification contains the account ID. VPC ID, and total amount of dropped packets. The company wants to subscribe a new Lambda function to the SNS topic. The new Lambda function must automatically prevent the traffic that is identified in each notification from leaving a VPC by applying a network ACL to the transit gateway attachment subnets in the VPC that generates the traffic. Which solution will meet these requirements?
Community Votes
71% of anonymous learners picked answer A. Votes are pick records left by other test-takers — they are not the verified answer.
Community Insight
The core test is understanding NACL rule direction: outbound rules filter traffic leaving a subnet and use destination IPs, while inbound rules use source IPs.
This ANS-C01 question explores how to automatically block traffic dropped by a transit gateway by applying network ACL rules. The community consensus favors adding destination IP addresses to SNS notifications and creating outbound NACL rules to prevent traffic from leaving the VPC.
Choosing option C (27% of votes), which incorrectly suggests using source IP addresses in an outbound NACL rule. Outbound NACL rules cannot filter by source IP; they target destination IPs.
Community Discussion (4 comments)
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
Expert Analysis
Why the Answer Is Correct
Option A is correct because the traffic identified in the flow logs is being dropped by the transit gateway, meaning it is outbound traffic from the VPC. To block it from leaving, you must create an outbound network ACL rule on the transit gateway attachment subnets. Outbound rules are evaluated based on the destination IP address. By adding the destination IP addresses of the dropped traffic to the SNS notification, the new Lambda function can create an outbound deny rule that matches those destinations, effectively preventing the traffic from leaving the VPC.
The comments supporting A correctly point out that “destination IP addresses identify where the problematic traffic is trying to go” and that “outbound rules prevent traffic from leaving the VPC.” This aligns with AWS network ACL semantics: an outbound rule uses the destination field, not the source field.
Why the Other Options Are Wrong
Option B is wrong because it uses source IP addresses and an inbound rule. Inbound rules apply to traffic entering a subnet, not leaving it, and they filter by source IP. This would not stop outbound traffic. Option C is the most tempting but fundamentally incorrect: outbound NACL rules do not have a “source” field; they only use destination addresses. Creating an outbound rule with source IP addresses is impossible in the AWS console or API. Option D is wrong because inbound rules use source IPs, not destination IPs, and the goal is to block outbound traffic.
One commenter voted C, saying “traffic is going out from EC2, need to identify the source,” but this misunderstands NACL outbound rule fields. While the source EC2 instance is indeed where the traffic originates, a NACL cannot match on source for egress traffic; it matches on destination. The commenter also suggested attaching an outbound constraint to the subnet ACL, which is correct in direction but uses the wrong IP field.
Community Comment Notes
A highly-liked comment explains A succinctly: adding a NACL outbound rule stops traffic from the VPC where it's generated, using the destination address because “only IP settable for outbound rules.” Another liked comment highlights the combination of destination IPs and outbound rules as the correct automation. The minority C voters focused on the source EC2 instance, but they missed the technical limitation of NACL outbound rules. The majority consensus (71%) chose A, and the correct AWS documentation confirms that outbound rules filter based on destination IP.
Overall, the key to this question is remembering that NACLs are stateless and each direction has a different set of filter fields. For egress traffic, you must use an outbound rule with a destination IP.
Official Reference
Exam Strategy
On exam day, immediately identify the traffic direction in the scenario. If traffic is leaving a VPC or subnet, focus on outbound NACL rules and destination IPs. If traffic is entering, focus on inbound rules and source IPs. This will help you eliminate options C and D quickly.
Related Analysis
Practice All ANS-C01 Questions
Access 137 questions with complete answers and detailed explanations.
View Full ANS-C01 Practice Test →