How do route tables work, including the local route and longest-prefix match?
IntermediateConceptVPC and Networking
Answer
Every subnet is associated with one route table (the main one if not explicit). Every table has an immutable local route for the VPC CIDR. When multiple routes match, the most specific prefix wins; for equal prefixes, static routes beat propagated ones and prefix-list/endpoint routes beat others.
aws ec2 create-route --route-table-id rtb-0abc \
--destination-cidr-block 0.0.0.0/0 --nat-gateway-id nat-0def
More on VPC and Networking
What is a VPC and what are the CIDR constraints?BeginnerWhat makes a subnet public or private?BeginnerInternet Gateway vs NAT Gateway: what does each do?BeginnerNAT Gateway vs NAT instance?IntermediateSecurity group vs network ACL: compare them.BeginnerWhat are the nuances of security group statefulness?Advanced