A SysOps Administrator is investigating high data transfer costs in a VPC. An application running on Amazon EC2 instances in a private subnet frequently communicates with external endpoints and AWS services. The administrator suspects that some traffic destined for Amazon S3 is being routed through a NAT Gateway instead of a configured VPC Gateway Endpoint for S3. The administrator decides to create a VPC Flow Log with a custom format to identify this traffic. Which of the following actions should the administrator take to verify whether traffic destined for Amazon S3 is traversing the NAT Gateway? (Select TWO.)
- Create a custom flow log format that includes the `pkt-dstaddr` field to capture the final destination IP address of the packets rather than the network interface destination IP.Answer
- Create a custom flow log format that includes the `traffic-path` field to identify whether egress traffic is routed through a NAT gateway or a gateway VPC endpoint.Answer
- CCreate a default VPC Flow Log and check the `dstaddr` field, which will display the Amazon S3 public IP address as the destination for traffic flowing from the EC2 instance through the NAT Gateway.
- DAssociate the subnet's route table with a Gateway VPC Endpoint for Amazon S3, then verify that the flow log's `dstaddr` field automatically changes from the NAT Gateway IP to the VPC endpoint service name.
- ECreate a custom flow log format that includes the `flow-direction` field, and verify that the value is set to `ingress` for the outbound traffic going from the EC2 instances to Amazon S3.
Answer
Create a custom flow log format that includes the `pkt-dstaddr` field, and create a custom flow log format that includes the `traffic-path` field.
To determine if traffic is traversing the NAT Gateway rather than using a Gateway VPC Endpoint, custom VPC Flow Log fields are required. The `pkt-dstaddr` field captures the packet-level destination IP address, which remains the S3 public IP address even when traffic passes through the NAT Gateway. In contrast, the standard `dstaddr` field would only show the private IP address of the NAT Gateway's network interface. Additionally, the `traffic-path` field provides a direct indicator of the egress route, where a value of 2 signifies a NAT Gateway and a value of 5 signifies a gateway VPC endpoint.
Step-by-Step Solution
Key Concept
Custom VPC Flow Logs allow administrators to capture advanced metadata, such as packet-level IP addresses (`pkt-dstaddr`) and routing paths (`traffic-path`), which is essential when diagnosing traffic flow through intermediate interfaces like NAT Gateways.