Fix Broken VPC Traffic After Removing AWS Network Firewall
In this article
Removing an AWS Network Firewall from your VPC can leave traffic broken if route tables, security groups, or subnet associations still reference the firewall endpoint. This guide walks you through the steps to restore normal traffic flow after deletion, covering route table cleanup, security group updates, and verification.
What You'll Need
- AWS Management Console access with permissions to modify VPC, route tables, and security groups (or equivalent CLI/API access).
- The VPC ID and subnet IDs where the firewall was deployed.
- Knowledge of your intended traffic paths (e.g., internet gateway, NAT gateway, peering).
Step-by-Step
- Confirm the firewall is fully deleted. In the AWS Console, go to VPC > Network Firewall > Firewalls. Ensure the firewall status is Deleted. If it's stuck in Deleting, wait or contact AWS support. A partially deleted firewall can still affect traffic.
- Identify route tables that had firewall endpoints. Go to VPC > Route Tables. For each route table associated with your subnets, look for routes with a target like
vpce-xxxxxxxx(the firewall endpoint) or a target type of Network Firewall (e.g.,vpce-...orfirewall-...). Note the route table IDs. - Remove firewall routes from route tables. For each route table identified, select it, go to the Routes tab, and click Edit routes. Delete any route that points to the firewall endpoint or firewall. Be careful not to delete routes for internet gateway (igw-), NAT gateway (nat-), or VPC peering (pcx-) unless they were added for the firewall. If the route table becomes empty, that's fine for a private subnet, but ensure you don't lose needed routes.
- Restore default routes if needed. If your subnets previously had a default route (0.0.0.0/0) to an internet gateway or NAT gateway, and that route was replaced by the firewall route, add it back. For public subnets, add
0.0.0.0/0to the IGW. For private subnets with internet access, add0.0.0.0/0to the NAT gateway. For private subnets without internet, you may not need a default route. - Check subnet associations. In the same route table view, verify which subnets are associated. If any subnet was explicitly associated with a route table that only had firewall routes, after cleanup it might have no routes. Ensure the subnet is associated with the correct route table (e.g., the main route table or a custom one with proper routes).
- Review security group rules. Go to VPC > Security Groups. Look for security groups that were created for the firewall or that reference the firewall endpoint in their rules. For example, a security group might allow traffic only from the firewall's ENI. Remove such rules or update them to allow traffic from the actual sources (e.g., 0.0.0.0/0 for public-facing resources, or specific CIDRs). Also check any rules that block traffic because the firewall was expected to filter it.
- Verify network ACLs (NACLs). If you modified NACLs to work with the firewall (e.g., allowing only firewall traffic), revert those changes. Go to VPC > Network ACLs and ensure inbound/outbound rules are appropriate for your subnets.
- Test connectivity. From an EC2 instance in the VPC, test traffic to the internet (if expected) and between subnets. For example, ping a public IP (if ICMP allowed) or use
curlto an external website. For internal traffic, try connecting to another instance's private IP. - Check route propagation (if using VPN/Direct Connect). If your VPC uses a VPN or Direct Connect, ensure the routes learned from those are still present and not overridden by stale firewall routes. In the route table, look for Propagated routes and confirm they are active.
- Monitor VPC flow logs. If you have VPC Flow Logs enabled, check them for dropped or rejected traffic. This can help identify if the issue is still route-related or if security groups/NACLs are blocking.
Common Mistakes
- Deleting the firewall before cleaning up routes. This leaves dangling routes that cause traffic to be dropped. Always clean up routes before or immediately after deletion.
- Removing all routes from a route table. If you delete the firewall route and there are no other routes, the subnet loses connectivity. Ensure you have a valid route to the target (IGW, NAT, etc.) before removing the firewall route.
- Forgetting about security group references. Security groups that only allow traffic from the firewall's ENI will block all traffic after the firewall is gone. Update them to allow traffic from the actual source.
- Overlooking NACL changes. NACLs are stateless; if you added rules to allow only firewall traffic, you must remove those and restore proper allow rules.
- Assuming the main route table is the only one. Subnets can have explicit associations to custom route tables. Check all route tables in the VPC.
Tips
- Use the AWS CLI for faster cleanup. You can use
aws ec2 describe-route-tablesto find routes with a firewall target, thenaws ec2 delete-routeto remove them. This is useful for multiple route tables. - Take a snapshot of route tables before changes. Screenshot or export the route tables before editing so you can revert if needed.
- Test in a non-production environment first. If possible, replicate the setup in a test VPC to understand the impact.
- Use VPC Reachability Analyzer. This tool (in the VPC console) can help you test paths between resources and identify where traffic is blocked.
- Check for resources that might have been created by the firewall. For example, the firewall might have created a custom route table or a security group. Delete those if they are no longer needed.
Troubleshooting
If traffic is still broken after following the steps:
- Verify the firewall is actually deleted. Sometimes deletion takes a few minutes. If it's stuck, check CloudTrail for errors.
- Check if there are any remaining firewall policy associations. The firewall policy might still be attached to the VPC. Go to Network Firewall > Policies and ensure no policy is associated with your VPC.
- Use Reachability Analyzer. Create a path from a source instance to a destination (e.g., internet gateway) and see where it fails. It will show you which route or security group is blocking.
- Check for overlapping routes. If you have a more specific route (e.g., /24) that points to a deleted firewall endpoint, it will override a general route. Remove any such specific routes.
- Inspect security group rules in detail. Look for any rule that references the firewall's ENI ID or the firewall's security group. Remove those.
- Review NACL rules for any deny rules. If you added a deny rule to block traffic that the firewall was supposed to handle, remove it.
- Check the route tables of any subnets that were not directly associated. They might be using the main route table, which could still have a firewall route.
Frequently Asked Questions
Why is my traffic still broken after deleting the firewall?
Most likely, there are still routes pointing to the firewall endpoint, or security group/NACL rules that were designed to work with the firewall are now blocking traffic. Follow the steps above to clean up all references.
Can I delete the firewall before removing routes?
Yes, but you risk breaking traffic immediately. It's safer to remove routes first, but if you already deleted it, just clean up the routes now.
What if my route table has no routes after removing the firewall route?
That's expected if the subnet is private and has no internet access. If it needs internet, add a route to the NAT gateway or internet gateway. If it needs to communicate with other VPCs, add the appropriate peering or transit gateway routes.
Do I need to delete the firewall policy separately?
Yes, if you no longer need it. The policy can be deleted after the firewall is deleted. It doesn't affect traffic, but it's good housekeeping.
How do I know which route tables had firewall routes?
Look for routes with a target that starts with vpce- (for VPC endpoints) or a target type of Network Firewall. You can also check the firewall's details in the console to see which route tables it was associated with.
Can security groups be reused after firewall removal?
Yes, but you must edit them to remove any rules that reference the firewall. If the security group was created solely for the firewall, you can delete it and update your instances to use a different security group.