- Más nuevo
- Más votos
- Más comentarios
Your observation about the intermittent behavior of EC2 Instance Connect endpoints is interesting and points to some complexities in how local routes work in VPC subnets.
When you replace the target of the local route with a network interface (in this case, your firewall EC2 instance), you are indeed changing how traffic within the subnet is handled. Contrary to what you might expect, this can affect intra-subnet traffic.
The local route in a VPC subnet typically allows communication between resources within the same subnet without leaving the subnet. However, when you change the target of this local route to point to a network interface in another subnet, you're essentially telling the VPC to send all traffic, including intra-subnet traffic, to that interface.
The intermittent nature of the issue you're experiencing could be due to several factors:
- Race conditions in route propagation
- Caching of routing information at various levels
- How the EC2 Instance Connect service interacts with the VPC networking stack
The forwarding loop you've observed (where traffic is sent to the firewall, then back to the subnet, and to the firewall again) is a side effect of this configuration. When the firewall receives traffic, it likely tries to forward it back to the destination in the original subnet, but because of the modified local route, it gets sent back to the firewall again.
To achieve your goal of a hub and spoke topology with a central firewall, you might want to consider alternative approaches:
-
Instead of modifying the local route, create more specific routes for inter-subnet communication that point to your firewall.
-
Use AWS Network Firewall or a third-party firewall solution that integrates more seamlessly with VPC routing.
-
Implement security groups and network ACLs to control traffic flow, which might be sufficient for your security needs without modifying routing.
-
If you need to keep your current setup, you may need to add specific routes or firewall rules to handle EC2 Instance Connect traffic separately.
Remember, modifying the local route is a powerful but potentially disruptive change to your VPC's networking behavior. It's generally recommended to use more granular routing rules or purpose-built security services to achieve network security goals.
Sources
Replace or restore the target for a local route - Amazon Virtual Private Cloud
VPC route table configuration for AWS Network Firewall - AWS Network Firewall
Inspect traffic between subnets - Amazon Virtual Private Cloud
Contenido relevante
- preguntada hace 4 meses
- preguntada hace 17 días
- preguntada hace 7 meses
- preguntada hace 17 días
- OFICIAL DE AWSActualizada hace 6 meses

I realize this is an AI post, but for others reading this... how would the functionality described in the AWS documentation (changing the local route to achieve subnet<->subnet inspection) ever work if AWS is evaluating the route table even for traffic destined for the same subnet? It seems this would always result in a routing loop as when packet gets routed back to the original subnet, it would seem the same route table would be consulted again and it would be sent right back out. I do understand that I can specify routes for every other subnet within each subnet, but this is not very elegant as existing subnets will automatically have paths to newly created subnets that bypass the inspection subnet, so adding a new subnet requires updating many route tables if you have many subnets.