Layering Network and Application Protection
Defence in depth places several independent controls between an attacker and a resource, so that one failure does not expose it. On AWS, network and application protection combine security groups, network ACLs, AWS WAF, AWS Shield, AWS Network Firewall and certificates for encryption, managed centrally with AWS Firewall Manager and verified by Config, Security Hub, GuardDuty and Detective. This lesson explains each layer and how they combine.
Learning outcomes
After completing this lesson, you will be able to:
- Distinguish between security groups and network ACLs and explain how each is used.
- Describe AWS WAF web ACLs, rule types and logging, and AWS Shield Standard and Advanced.
- Explain how AWS Network Firewall inspects VPC traffic and where it is deployed.
- Explain how Firewall Manager applies protections across an organisation and how the layers form defence in depth.
Security Groups and Network ACLs
Security groups are stateful firewalls attached to network interfaces. They contain only allow rules; return traffic for allowed connections is permitted automatically. Rules can reference other security groups, such as allowing the database group to accept traffic only from the application group, which keeps rules correct as instances change. Network ACLs are stateless filters at the subnet boundary with numbered allow and deny rules evaluated in order; because they are stateless, return traffic, including ephemeral ports, must be allowed explicitly. Security groups are the primary control; network ACLs add a coarse subnet-level layer, for example blocking a known malicious range quickly.
AWS WAF and AWS Shield
AWS WAF protects web applications at layer 7. A web ACL is associated with a CloudFront distribution, an ALB, an API Gateway REST API stage, an AWS AppSync API, an Amazon Cognito user pool or other supported resources. It contains rules evaluated in priority order: AWS managed rule groups, such as the core rule set, known bad inputs, SQL injection, IP reputation lists, and Bot Control and account takeover prevention; custom rules matching IP sets, headers, body, geography or regular expressions; and rate-based rules that block clients exceeding a request rate. Rules can count before they block, which allows safe testing. WAF logs go to CloudWatch Logs, S3 or Firehose, and CloudWatch metrics show matched requests per rule.
AWS Shield Standard protects all AWS customers automatically against common network and transport layer DDoS attacks. Shield Advanced adds enhanced detection and mitigation for protected resources such as CloudFront distributions, Route 53 hosted zones, Application Load Balancers and Elastic IP addresses, automatic application layer mitigation that creates WAF rules during attacks, access to the Shield Response Team, health-based detection using Route 53 health checks, and cost protection for scaling charges caused by attacks.
AWS Network Firewall
AWS Network Firewall is a managed, stateful network firewall and intrusion prevention service for VPCs. Firewall endpoints are deployed in dedicated subnets, and route tables send traffic through them. Rule groups include stateless rules for fast packet filtering, stateful rules with five-tuple matching, domain list rules that allow or deny outbound traffic by domain name (for example allowing instances to reach only approved package repositories), and Suricata-compatible intrusion prevention rules, plus AWS managed threat signature rule groups. TLS inspection can decrypt and inspect encrypted traffic. Logs of alerts and flows go to S3, CloudWatch Logs or Firehose.
Network Firewall is typically deployed in a centralised inspection VPC attached to a Transit Gateway, so that traffic between VPCs, to the internet and to on-premises networks passes through one inspection point, or in each VPC for distributed designs. It complements security groups, which cannot filter by domain or inspect payloads, and WAF, which protects only HTTP applications behind supported resources.
Central Management with AWS Firewall Manager
Configuring these protections in every account by hand leads to gaps. AWS Firewall Manager, run from an administrator account in the organisation, defines security policies that apply protections automatically to accounts, OUs and resources by tag, including new ones: AWS WAF web ACLs on all ALBs and CloudFront distributions, Shield Advanced protections, security group policies (common groups, audit of over-permissive rules, removal of unused groups), network ACL policies, Network Firewall deployments per VPC and Route 53 Resolver DNS Firewall rules. Non-compliant resources are reported and can be remediated automatically. Firewall Manager requires AWS Organizations and AWS Config.
Choose the protection
Defence in Depth
No single control is sufficient. The table below shows how the services named in the exam guide combine into layers for a typical internet-facing application.
| Layer | Controls |
|---|---|
| Edge | CloudFront with AWS WAF and Shield; TLS certificates from ACM |
| Perimeter | ALB with WAF; security groups allowing only CloudFront or the ALB |
| Network | Network ACLs; Network Firewall for egress domain filtering and intrusion prevention |
| Host and container | Security groups per tier; IMDSv2; patching; GuardDuty Runtime Monitoring; Inspector scanning |
| Data | Encryption with KMS; TLS in transit; Macie for sensitive data |
| Identity | Least-privilege roles; SCPs and RCPs; MFA |
| Detection and response | Config rules, Security Hub, GuardDuty, Detective, EventBridge automation |
Each layer is applied centrally: Firewall Manager for network and WAF policies, Security Hub and Config for posture, Organizations and Control Tower for guardrails, so that new accounts and resources are protected without manual steps.
Protecting a Public Application Across Accounts
An organisation runs public web applications in 25 accounts. Some teams forget WAF, one application was taken offline by an HTTP flood, and instances must not download software from arbitrary internet sites.
-
WAF everywhere
Create a Firewall Manager WAF policy that applies a web ACL with AWS managed rule groups and a rate-based rule to every ALB and CloudFront distribution in the workload OUs, with auto remediation.
-
DDoS
Subscribe to Shield Advanced and use a Firewall Manager Shield policy to protect the public endpoints, with health-based detection.
-
Egress control
Route outbound traffic through Network Firewall in a central inspection VPC with a domain allow list.
-
Verification
Security Hub controls and Firewall Manager compliance reports detect gaps; GuardDuty watches for threats that pass the layers.
Why must network ACL rules explicitly allow ephemeral ports for return traffic, while security groups do not?
Show answer
Network ACLs are stateless and evaluate each packet independently, so responses need their own allow rules. Security groups are stateful and allow return traffic for permitted connections automatically.
Exam Tips
Remember for the exam
- Security groups are stateful and allow-only; network ACLs are stateless with ordered allow and deny rules.
- AWS WAF web ACLs use managed rule groups, custom rules and rate-based rules on CloudFront, ALB, API Gateway, AppSync and Cognito; Shield Advanced adds DDoS response and cost protection.
- AWS Network Firewall provides stateful inspection, domain filtering and Suricata IPS, often in a central inspection VPC.
- AWS Firewall Manager applies WAF, Shield, security group, network ACL, Network Firewall and DNS Firewall policies across an organisation.
- Defence in depth layers edge, network, host, data, identity and detection controls.