For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/security/code_security/iac_security/iac_rules/cloudformation-aws-vpc-without-network-firewall.md.
A documentation index is available at /llms.txt.
VPCs should be associated with AWS Network Firewall to enable centralized traffic inspection and enforcement of network policies. This helps prevent lateral movement and detect or block malicious east–west and north–south traffic.
This rule checks CloudFormation for AWS::EC2::VPC resources that are not referenced by any AWS::NetworkFirewall::Firewall via the firewall’s Properties.VpcId. The VpcId property in AWS::NetworkFirewall::Firewall must reference the VPC (for example, using Ref to the VPC logical ID). VPC resources without an associated AWS::NetworkFirewall::Firewall will be flagged.
Secure configuration example (Network Firewall referencing the VPC):