How to reduce high NAT gateway costs for EC2 workloads using S3 and DynamoDB?
A company is replatforming a legacy data processing solution to AWS. The company deploys the solution on Amazon EC2 Instances in private subnets that are in one VPC. The solution uses Amazon S3 for abject storage. Both the data that the solution processes and the data the solution produces are stored in Amazon S3. The solution uses Amazon DynamoDB to save its own state. The company collects flow logs for the VPC. The solution uses one NAT gateway to register its license through the internet. A software vendor provides a specific hostname so the solution can register its license. The company notices that the AWS bill exceeds the projected budget for the solution. A network engineer uses AWS Cost Explorer to investigate the bill. The network engineer notices that the USE2-NatGateway-Bytes($) usage type is the root cause of the higher than expected bill. What should the network engineer do to resolve the issue? (Choose two.)
Community Votes
100% of anonymous learners picked answer BE. Votes are pick records left by other test-takers — they are not the verified answer.
Community Insight
The question tests your understanding of NAT gateway data processing costs and the role of gateway VPC endpoints in keeping AWS service traffic off the internet-facing path. The common trap is confusing traffic inspection or restrictive security groups with the actual solution: routing S3 and DynamoDB traffic through VPC endpoints.
This question focuses on diagnosing unexpectedly high AWS NAT gateway charges caused by private EC2 instances sending traffic to S3 and DynamoDB through the NAT gateway. The community consensus is to examine VPC Flow Logs to identify the traffic and to verify that gateway VPC endpoints for S3 and DynamoDB are configured and associated with the private subnet route tables.
The most common wrong answers are C (using AWS Cost and Usage Report) and D (restricting security groups). Candidates pick C because they think more billing detail will reveal the cause, but it does not provide per-flow traffic details. Candidates pick D because they think blocking traffic helps, but it fails to solve the root cause: S3 and DynamoDB traffic still traverses the NAT gateway.
Community Discussion (10 comments)
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
Expert Analysis
Understanding the Problem
A NAT gateway incurs two types of charges: an hourly hourly rate and a per-GB data processing fee for all traffic that passes through it. When EC2 instances in private subnets need to reach Amazon S3 or DynamoDB, the default route is often via a NAT gateway. This means every API call and data transfer to/from S3 and DynamoDB is charged as NAT gateway processing. Since the company stores both input and output data in S3 and uses DynamoDB for state, the volume of traffic can be very large, causing the bill to exceed the budget.
Correct Answer: B and E
Option B — Examine VPC Flow Logs. VPC Flow Logs capture information about IP traffic going to and from network interfaces in the VPC, including the NAT gateway's elastic network interface. By querying the flow logs, the network engineer can identify which destinations consume the most bytes and which traffic flows through the NAT gateway. This helps confirm whether S3 and DynamoDB traffic is using the NAT gateway and provides the data needed to justify the next step.
Option E — Verify gateway VPC endpoints for S3 and DynamoDB. Amazon S3 and DynamoDB both support gateway VPC endpoints (type Gateway). These endpoints are free and allow private subnets to access S3 and DynamoDB without leaving the AWS network, eliminating NAT data processing costs. A gateway endpoint works by adding a route to the VPC route table, directed to a prefix list (e.g., pl-xxxx). Simply creating the endpoint is not enough; it must be associated with the route tables of the private subnets. If it is correctly configured, traffic destined to S3 and DynamoDB will use the endpoint instead of the NAT gateway, significantly reducing charges.
Why Other Options Are Incorrect
Option A — VPC Traffic Mirroring is not a cost investigation tool. It copies live traffic from network interfaces to a monitoring appliance, adding complexity and cost. It might show traffic content, but flow logs already provide the metadata needed to identify the traffic source, destination, and byte counts.
Option C — Cost and Usage Report helps break down charges by usage type but does not show the actual network flows inside the VPC. It can confirm that NAT gateway charges are high, but it cannot tell you which IP addresses or services are generating the traffic. Flow logs are the correct tool for that.
Option D — Security group changes could potentially reduce unwanted traffic, but the core problem is that legitimate traffic to S3 and DynamoDB is traversing the NAT gateway. Restricting outbound traffic to only specific IP addresses does not resolve the cost issue; it could even break the license activation or other required traffic. The correct fix is to route AWS service traffic through VPC endpoints, not to block it.
Community Insights
Most community voters selected BE, with comments explaining that flow logs reveal traffic details and gateway endpoints reduce cost. One commenter specifically noted that "Cost and Billing Reports will help but not specific traffic details." Another correctly pointed out that traffic mirroring is not needed and adds cost. The consensus is clear: identify the traffic via flow logs, then eliminate NAT gateway usage for S3 and DynamoDB by using gateway endpoints.
Official Reference
- https://docs.aws.amazon.com/vpc/latest/userguide/flow-logs.html
- https://docs.aws.amazon.com/vpc/latest/userguide/vpc-nat-gateway.html
- https://docs.aws.amazon.com/vpc/latest/userguide/vpce-gateway.html
- https://docs.aws.amazon.com/vpc/latest/userguide/vpc-endpoints-s3.html
- https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/vpc-endpoints-dynamodb.html
Exam Strategy
When you see a NAT gateway cost problem, immediately think of two steps: inspect the actual traffic using VPC Flow Logs and remove AWS service traffic from the NAT path using VPC endpoints. Remember that gateway VPC endpoints are free and are the correct fix for S3 and DynamoDB, while interface endpoints are for other services. Avoid picking options that merely describe more billing tools or security group hardening, as they do not address the root cause.
Related Analysis
Practice All ANS-C01 Questions
Access 137 questions with complete answers and detailed explanations.
View Full ANS-C01 Practice Test →