
I Tried Out the Automated Internet Firewall in AWS Network Firewall
This page has been translated by machine translation. View original
Introduction
On November 20, 2026, the automated Internet firewall for AWS Network Firewall was announced as a public preview.
The automated Internet firewall is a feature that performs inspection and NAT with Network Firewall at a VPC's internet gateway (IGW). The announcement states that it can be applied to many VPCs without any routing changes.
In this article, I applied the automated Internet firewall to a single VPC using the AWS CLI and verified the inspection and NAT behavior at the IGW.
Test Environment
- Region: Tokyo (ap-northeast-1)
- AWS CLI: 2.42.1
- VPC: Newly created (10.99.0.0/24)
- AZ: ap-northeast-1a only
- EC2: t4g.micro, no public IP, operated via SSM
There are three subnets, as follows.
| Subnet | Target of 0.0.0.0/0 | What is placed there |
|---|---|---|
| For the NAT gateway | IGW | NAT gateway |
| For EC2 (toward the NAT gateway) | NAT gateway | 1 EC2 instance |
| For EC2 (toward the IGW) | IGW | 1 EC2 instance |
Configuration
The automated Internet firewall is configured with Network Security Manager (NSM) rules, policies, scopes, and deployments. To perform the same operations in the console, follow the Quick create and deploy procedure in the official documentation.
NSM rule
I created three rules: one specifying the mode (monitor), one blocking example.org, and one specifying the log destinations (alert and flow to CloudWatch Logs). I created the two log groups that the logging rule points to beforehand.
aws logs create-log-group --log-group-name /igwfw-verify/nfw-alert
aws logs create-log-group --log-group-name /igwfw-verify/nfw-flow
I saved the mode rule in artifacts/rule-mode-monitor.json.
{"PolicyMode":"MONITOR"}
I wrote the rule that blocks example.org in artifacts/rule-deny-domain.json in string format (RulesString). It drops traffic whose TLS SNI or HTTP Host is example.org or one of its subdomains.
{
"FirewallRuleGroupEntry": {
"Priority": 1,
"InlineRuleGroup": {
"RulesSource": {
"RulesString": "drop:flow tls:client_hello $HOME_NET any -> $EXTERNAL_NET any (tls.sni; dotprefix; content:\".example.org\"; nocase; endswith; msg:\"igwfw-verify deny example.org\"; flow:to_server; sid:1000001; rev:1;)\ndrop:flow http1:request_headers $HOME_NET any -> $EXTERNAL_NET any (http.host; dotprefix; content:\".example.org\"; endswith; msg:\"igwfw-verify deny example.org http\"; flow:to_server; sid:1000002; rev:1;)"
}
}
}
}
I wrote the log destinations in artifacts/rule-logging.json.
{"LoggingConfiguration":{"LogDestinationConfigs":[{"LogType":"ALERT","LogDestinationType":"CloudWatchLogs","LogDestination":{"logGroup":"/igwfw-verify/nfw-alert"}},{"LogType":"FLOW","LogDestinationType":"CloudWatchLogs","LogDestination":{"logGroup":"/igwfw-verify/nfw-flow"}}]}}
Only the logging rule was created with --rule-type CONFIGURATION; the other two were created with INSPECTION.
aws network-security-manager create-rule --rule-name igwfw-verify-mode --firewall-type IGW_FIREWALL --rule-type INSPECTION --configuration file://artifacts/rule-mode-monitor.json --output json
aws network-security-manager create-rule --rule-name igwfw-verify-logging --firewall-type IGW_FIREWALL --rule-type CONFIGURATION --configuration file://artifacts/rule-logging.json --output json
aws network-security-manager create-rule --rule-name igwfw-verify-deny-example-org --firewall-type IGW_FIREWALL --rule-type INSPECTION --configuration file://artifacts/rule-deny-domain.json --output json
I also included the AWS managed template AWSManagedTemplateIGWFirewallBaseline in the policy. The ARN can be obtained with list-templates.
aws network-security-manager list-templates --template-owner AWS --output json
Policy and scope
I defined the policy in artifacts/policy-rules.json, which lists the template and the three rules.
[{"templateIdentifier":"arn:aws:network-security-manager:ap-northeast-1:aws:template:AWSManagedTemplateIGWFirewallBaseline"},{"ruleIdentifier":"arn:aws:network-security-manager:ap-northeast-1:111122223333:rule:<deny-rule-id>"},{"ruleIdentifier":"arn:aws:network-security-manager:ap-northeast-1:111122223333:rule:<mode-rule-id>"},{"ruleIdentifier":"arn:aws:network-security-manager:ap-northeast-1:111122223333:rule:<logging-rule-id>"}]
I set the subnet connectivity type to flexible in artifacts/policy-config.json.
{"remediationEnabled":true,"resourcesCleanUp":true,"igwFirewallConfig":{"defaultSubnetConnectivity":"flexible"}}
In artifacts/scope-config.json, I specified only the ARN of the test VPC in explicitArns for the scope.
{"resourceScopes":{"AWS::EC2::VPC":{"include":{"explicitArns":["arn:aws:ec2:ap-northeast-1:111122223333:vpc/vpc-0123456789abcdef0"]}}}}
aws network-security-manager create-scope --scope-name igwfw-verify-scope --scope-configuration file://artifacts/scope-config.json --output json
aws network-security-manager create-policy --policy-name igwfw-verify-policy --priority 1 --firewall-type IGW_FIREWALL --associated-template-and-rule-list file://artifacts/policy-rules.json --policy-configuration file://artifacts/policy-config.json --output json
Deployment
I created the deployment by passing the ARNs of the policy and the scope.
aws network-security-manager create-deployment --deployment-name igwfw-verify-deployment --deployment-configuration enableCrossAccountVisibility=false --associated-policy-list policyIdentifier=<policy-arn> --associated-scope-list scopeIdentifier=<scope-arn> --output json
State after deployment
Creation of the firewall
Immediately after creating the deployment, the NSM synchronization status was OUT_OF_SYNC. The reason was that the VPC was not yet registered with an IGW firewall.
aws network-security-manager list-resource-synchronization-statuses --deployment-identifier <deployment-arn> --output json
aws network-firewall list-firewalls --firewall-type IGW_FIREWALL --output json
aws network-firewall describe-firewall --firewall-arn arn:aws:network-firewall:ap-northeast-1:111122223333:igw-firewall/vpc-0123456789abcdef0 --output json
When I checked about 1.5 minutes after creating the deployment, the igw-firewall appeared in the list in the PROVISIONING state. When I checked about 9 minutes later, it was READY. One NAT IP was assigned to the firewall in ap-northeast-1a. Only the firewall of the test VPC was shown in the IGW firewall list.
Route table
After deployment, an IgwFirewall entry was added to the IGW route in the route table shared by the two IGW-facing subnets. Comparing the entire output of describe-route-tables before and after deployment, this was the only difference, and the route destinations and associations did not change.
aws ec2 describe-route-tables --filters Name=vpc-id,Values=vpc-0123456789abcdef0 --query 'RouteTables[].{Id:RouteTableId,Name:Tags[?Key==`Name`]|[0].Value,Routes:Routes,Subnets:Associations[].SubnetId}' --output json
{
"DestinationCidrBlock": "0.0.0.0/0",
"GatewayId": "igw-0123456789abcdef0",
"Origin": "CreateRoute",
"State": "active",
"IgwFirewall": {
"FirewallArn": "arn:aws:network-firewall:ap-northeast-1:111122223333:igw-firewall/vpc-0123456789abcdef0",
"Status": "active"
}
}
NAT and source IP
Before deployment, the EC2 instance without a public IP in the IGW-facing subnet could not reach the internet and was not registered with SSM. After deployment, it was registered with SSM as Online, so I checked the source IP with checkip.amazonaws.com.
| EC2 | Target of 0.0.0.0/0 | Result of checkip.amazonaws.com after deployment | Type of IP |
|---|---|---|---|
| IGW-facing subnet | IGW | 203.0.113.10 | NAT IP of the firewall |
| NAT gateway-facing subnet | NAT gateway | 198.51.100.20 | Elastic IP of the NAT gateway |
The NAT IP of the firewall was an Elastic IP in my own account with ServiceManaged set to igw-firewall.
When the connectivity type is flexible, resources without a public IP in a subnet that has a route to the IGW can also connect to the internet.
Verification in monitor mode
Alert log
In monitor mode, I accessed example.org, www.example.org, and example.com over HTTPS from the EC2 instance in the IGW-facing subnet. All results were HTTP 200.
I checked the alert log in the CloudWatch Logs group /igwfw-verify/nfw-alert.
aws logs filter-log-events --log-group-name /igwfw-verify/nfw-alert --filter-pattern '"example"' --query 'events[].message' --output json
Many allowed records from the default packet policy and app policy were recorded in the alert log. The signatures were SURICATA FW default packet policy and SURICATA FW default app policy, and SSM traffic was included as well. For the blocking rule (signature igwfw-verify deny example.org), traffic with the SNI example.org was also recorded as allowed.
The alert log records could be seen about 4.5 minutes after the traffic.
The alert log also recorded, as allowed, traffic coming in from internet-side sources to the private IP of the NAT gateway.
VPC flow logs
To compare before and after READY, I created the VPC flow log before creating the deployment. I included traffic-path in the custom format. I created the IAM role and log group beforehand.
aws ec2 create-flow-logs --resource-type VPC --resource-ids vpc-0123456789abcdef0 --traffic-type ALL --log-destination-type cloud-watch-logs --log-group-name /igwfw-verify/vpc-flow --deliver-logs-permission-arn arn:aws:iam::111122223333:role/igwfw-verify-flowlog --max-aggregation-interval 60 --log-format '${version} ${interface-id} ${srcaddr} ${dstaddr} ${srcport} ${dstport} ${protocol} ${pkt-srcaddr} ${pkt-dstaddr} ${action} ${traffic-path} ${tcp-flags}'
Using the time at which I confirmed the firewall became READY as the boundary, I counted the flow log records by traffic-path.
== igw-instance eni-0123456789abcdef0
after-ready ACCEPT traffic-path=- 24
after-ready ACCEPT traffic-path=8 1
after-ready ACCEPT traffic-path=9 25
before-ready - traffic-path=- 1
before-ready ACCEPT traffic-path=8 67
== natgw eni-0123456789abcdef1
after-ready - traffic-path=- 8
after-ready ACCEPT traffic-path=- 239
after-ready ACCEPT traffic-path=1 8
after-ready ACCEPT traffic-path=8 3
after-ready ACCEPT traffic-path=9 16
before-ready - traffic-path=- 28
before-ready ACCEPT traffic-path=- 1213
before-ready ACCEPT traffic-path=1 56
before-ready ACCEPT traffic-path=8 57
before-ready ACCEPT traffic-path=9 1
For the egress of the EC2 instance in the IGW-facing subnet, traffic-path was 8 before READY, but mainly 9 afterward. According to the official documentation, 9 indicates that the traffic was processed by the firewall's egress. On the NAT gateway's ENI, 9 was recorded once before READY and 16 times after.
Switching to enforce mode
Running update-rule
I updated the mode rule to ENFORCE. The contents of artifacts/rule-mode-enforce.json are as follows.
{"PolicyMode":"ENFORCE"}
For --update-token, I specified the value included in the create-rule response.
aws network-security-manager update-rule --rule-identifier arn:aws:network-security-manager:ap-northeast-1:111122223333:rule:<mode-rule-id> --update-token <update-token> --rule-type INSPECTION --configuration file://artifacts/rule-mode-enforce.json --is-published --output json
About 2 minutes after the update, I checked connectivity from the EC2 instance in the IGW-facing subnet with the following commands.
for h in example.org www.example.org; do
curl -s -m 10 -o /dev/null -w "$h http=%{http_code}\n" https://$h
echo "$h curl-exit=$?"
done
curl -s -m 10 -o /dev/null -w "http://example.org http=%{http_code}\n" http://example.org
echo "http://example.org curl-exit=$?"
| Destination | HTTP status | curl exit code |
|---|---|---|
| https://example.org | 000 | 28 |
| https://www.example.org | 000 | 28 |
| http://example.org | 000 | 28 |
All three destinations matching the rule in rule-deny-domain.json resulted in curl exit code 28 (timeout).
Record of blocking
With the RulesString format rule, no blocked records appeared in the alert log when searching by the signature igwfw-verify.
So I rewrote the blocking rule in the FirewallRules format. I added "AlertEnabled": true to each rule (artifacts/rule-deny-domain-alert.json).
rule-deny-domain-alert.json
{
"FirewallRuleGroupEntry": {
"Priority": 1,
"InlineRuleGroup": {
"RulesSource": {
"FirewallRules": [
{
"Action": "DROP",
"ActionScope": "FLOW",
"Hook": "TLS_CLIENT_HELLO",
"Protocol": "TLS",
"SourceIPs": "$HOME_NET",
"DestIPs": "$EXTERNAL_NET",
"SourcePorts": "any",
"DestPorts": "any",
"RuleOptions": [
{
"Keyword": "tls.sni"
},
{
"Keyword": "dotprefix"
},
{
"Keyword": "content",
"Settings": [
"\".example.org\""
]
},
{
"Keyword": "nocase"
},
{
"Keyword": "endswith"
},
{
"Keyword": "msg",
"Settings": [
"\"igwfw-verify deny example.org TLS\""
]
},
{
"Keyword": "sid",
"Settings": [
"1000001"
]
},
{
"Keyword": "rev",
"Settings": [
"1"
]
}
],
"AlertEnabled": true
},
{
"Action": "DROP",
"ActionScope": "FLOW",
"Hook": "HTTP1_REQUEST_HEADERS",
"Protocol": "HTTP",
"SourceIPs": "$HOME_NET",
"DestIPs": "$EXTERNAL_NET",
"SourcePorts": "any",
"DestPorts": "any",
"RuleOptions": [
{
"Keyword": "http.host"
},
{
"Keyword": "dotprefix"
},
{
"Keyword": "content",
"Settings": [
"\".example.org\""
]
},
{
"Keyword": "endswith"
},
{
"Keyword": "msg",
"Settings": [
"\"igwfw-verify deny example.org HTTP\""
]
},
{
"Keyword": "sid",
"Settings": [
"1000002"
]
},
{
"Keyword": "rev",
"Settings": [
"1"
]
}
],
"AlertEnabled": true
}
]
}
}
}
}
I ran the update in the same way as for the mode rule. I specified the ARN of the blocking rule as the target, and the value included in the create-rule response for --update-token.
aws network-security-manager update-rule --rule-identifier arn:aws:network-security-manager:ap-northeast-1:111122223333:rule:<deny-rule-id> --update-token <update-token> --rule-type INSPECTION --configuration file://artifacts/rule-deny-domain-alert.json --is-published --output json
After the update, blocked records appeared in the alert log. The signature was igwfw-verify deny example.org TLS, the hook was tls:client_hello, and the SNI was example.org.
Summary
I verified the behavior of the automated Internet firewall for AWS Network Firewall, which has started to be offered as a public preview.
With conventional Network Firewall, you needed to prepare dedicated subnets for endpoints and adjust route tables for each protected subnet. I confirmed that the automated Internet firewall requires neither.
If you are using a NAT gateway and want to introduce Network Firewall, but adding dedicated subnets to existing VPCs or changing routing settings has been a barrier, please try the automated Internet firewall.
