Interview Prep/Networking/Cloud networking: VPC, firewalls, NAT, VPN and proxies

A VPC peering connection is `Active`, but instances in the two VPCs can't ping each other.

BeginnerTroubleshootingCloud networking: VPC, firewalls, NAT, VPN and proxies
Answer

Likely causes → Peering does not add routes. Both VPCs' route tables need a route to the other's CIDR via the pcx- connection, and both SGs must allow the traffic (ICMP for ping). Also: peering is not transitive.

Diagnose →

aws ec2 describe-route-tables --filters Name=vpc-id,Values=<vpc-a> \
  --query 'RouteTables[].Routes[?VpcPeeringConnectionId]'
aws ec2 describe-security-groups --group-ids <sg-b>

Fix → Add 10.1.0.0/16 → pcx-xxxx in VPC A's route tables and 10.0.0.0/16 → pcx-xxxx in VPC B's, then allow the source CIDR (or the peer SG, same region only) in the SGs.

Prevent → Create peering, routes and SG rules in the same Terraform module so none can be forgotten.

All Networking questions Roadmap: Networking for DevOps

More on Cloud networking: VPC, firewalls, NAT, VPN and proxies