Skip to content

Firewall

Source: src/AWS/NetworkFirewall/Firewall.ts

An AWS Network Firewall firewall — provisions managed firewall endpoints into your VPC subnets and inspects traffic according to an associated FirewallPolicy.

Endpoint provisioning takes several minutes (typically 5-10), and deleting a firewall waits for the endpoints to deprovision.

import * as EC2 from "alchemy/AWS/EC2";
import * as NetworkFirewall from "alchemy/AWS/NetworkFirewall";
const vpc = yield* EC2.Vpc("Vpc", { cidrBlock: "10.0.0.0/16" });
const subnet = yield* EC2.Subnet("FirewallSubnet", {
vpcId: vpc.vpcId,
cidrBlock: "10.0.1.0/24",
});
const policy = yield* NetworkFirewall.FirewallPolicy("Policy", {
firewallPolicy: {
StatelessDefaultActions: ["aws:pass"],
StatelessFragmentDefaultActions: ["aws:pass"],
},
});
const firewall = yield* NetworkFirewall.Firewall("Firewall", {
firewallPolicyArn: policy.firewallPolicyArn,
vpcId: vpc.vpcId,
subnetMappings: [{ SubnetId: subnet.subnetId }],
});