A subnet's route table contains three entries: 10.0.0.0/8 targeting a virtual private gateway, 10.0.1.0/24 targeting a NAT gateway, and 10.0.1.128/25 targeting 'local'. A packet is destined for 10.0.1.150. Which route does AWS use to forward this packet?
- The 10.0.0.0/8 route, because routes are evaluated in the order they were created and this one was created first
- The 10.0.1.128/25 route, because AWS selects the most specific (longest prefix) matching route regardless of creation order
- All three routes are used simultaneously, splitting the traffic across each target
- The 10.0.1.0/24 route, because NAT gateway targets always take precedence over other target types
Why B? And why not the others?
Correct answer: B. The 10.0.1.128/25 route, because AWS selects the most specific (longest prefix) matching route regardless of creation order
When a destination address matches more than one route in a route table, AWS VPC routing always selects the route with the longest (most specific) matching prefix, independent of when each route was added or what type of target it points to; 10.0.1.150 falls inside all three CIDR ranges given, but 10.0.1.128/25 is the narrowest match, so that 'local' route wins. Option A is wrong because route selection is based purely on prefix specificity, not insertion order — AWS does not track or use a creation-order priority at all. Option C is wrong because exactly one route is ever chosen per packet; VPC route tables do not support splitting or load-balancing traffic across multiple simultaneously matching routes. Option D is wrong because there is no target-type-based precedence in VPC routing; a /24 pointing at a NAT gateway never outranks a more specific /25 local route just because of what its target is.
Source: AWS VPC docs: Route tables — route selection