Cloud concept · Updated

Defense in Depth - Defense in Depth is a security strategy that uses multiple complementary layers of protection so that failure of one control does not expose the entire system.

In short

Defense in Depth combines preventive, detective, and response controls across network boundaries, identities, applications, hosts, and data. It reduces dependence on any single safeguard and limits the impact of successful attacks, configuration mistakes, and compromised credentials.

Cloud Concepts Hub →

6 key aspects of Defense in Depth

Effective Defense in Depth combines complementary controls, segmented trust boundaries, threat-specific edge protection, least privilege, and tested detection and response.

01
Complementary protection layers

Combine controls with different functions and failure modes, such as edge filtering, workload network restrictions, identity authorization, and data permissions. Repeating one permissive policy across several products does not provide meaningful independence.

02
Segmentation and containment

Separate workloads by trust level and permit only required communication between them. Protect both north/south entry paths and east/west connections so a compromised workload cannot freely reach adjacent systems.

03
Threat-aligned edge defenses

Choose controls according to the expected attack: DDoS protection for traffic floods, HTTP filtering for malicious web requests, and origin restrictions for bypass prevention. Account for the protocols and endpoints each control actually protects.

04
Explicit trust and least privilege

Treat network reachability as only one prerequisite for access, not proof of authorization. Require appropriate identities and narrowly scoped permissions even for requests originating inside private networks.

05
Detection and response coverage

Collect network, application, and identity telemetry to detect attacks that preventive controls miss. Connect alerts to response procedures that can isolate workloads or revoke access without unnecessarily disrupting unrelated systems.

06
Validated paths and failure behavior

Verify that traffic traverses the intended controls and cannot take an unprotected alternate route. Test return paths, failover routing, and control outages to identify both security gaps and availability risks.

Cloud services for Defense in Depth

Amazon VPC establishes network boundaries and permitted paths, while AWS Network Firewall inspects selected traffic routed through those paths. For internet-facing web applications, Amazon CloudFront, AWS Shield, and AWS WAF provide complementary delivery, DDoS, and HTTP-filtering layers. Origin restrictions ensure those edge layers cannot be bypassed. IAM independently limits the AWS operations available to users and workloads, including workloads with valid network access. Together, these services address different attack stages rather than providing interchangeable protection. Their effectiveness depends on explicit routing, scoped permissions, coordinated logging, and tests that verify both allowed access and blocked attack paths.

Amazon VPCAmazon VPC

Amazon VPC provides subnets, route tables, security groups, and network ACLs for layered network segmentation. Engineers must combine routing and filtering deliberately because private or isolated subnet placement alone does not prevent lateral access.

AWS WAFAWS WAF

AWS WAF filters HTTP and HTTPS requests on supported resources using rules such as request matching and rate-based controls. It complements network controls and DDoS defenses but does not replace application authorization or protect arbitrary transport protocols.

AWS ShieldAWS Shield

AWS Shield provides DDoS protection, with Standard automatically included and Advanced offering additional capabilities for eligible protected resources. It addresses availability attacks as one layer rather than replacing web request filtering, segmentation, or origin protection.

AWS Network FirewallAWS Network Firewall

AWS Network Firewall provides managed network traffic filtering and inspection for traffic routed through its firewall endpoints. It can enforce ingress, egress, or east/west policies, but coverage depends on routing design and supported symmetric traffic flows.

Amazon CloudFrontAmazon CloudFront

Amazon CloudFront places a distributed delivery layer in front of applications and integrates with AWS WAF and AWS Shield. Restrict origin access separately so attackers cannot bypass edge controls by addressing the origin directly.

Defense in Depth exam questions

Real practice exam questions on Defense in Depth, with the correct answer and its explanation. Answer them with every option in the exam simulator.

SAA-C03

A company runs a payment application on Amazon EC2 instances behind an Application Load Balancer (ALB). AWS WAF filters requests at the ALB. The application retrieves one database credential from AWS Secrets Manager. Other applications run in the same VPC.

A security review requires additional safeguards in case malicious requests bypass AWS WAF or another workload in the VPC is compromised. Only the ALB must be able to initiate connections to the payment application's listening port. The application's AWS permissions must not allow it to retrieve unrelated secrets, even if its code is exploited. The company must also retain an audit history of secret retrieval API calls.

Which solution meets these requirements?

Show answerCORRECT ANSWER

Place the application instances in private subnets. Allow their application port only from the ALB's security group. Grant their IAM role secretsmanager:GetSecretValue on only the required secret ARN. Configure a CloudTrail trail to record read and write management events.

This combines independent network, identity, and audit controls. The application security group restricts connections to traffic from the ALB's security group, the IAM policy limits secret retrieval to the required secret, and CloudTrail records Secrets Manager retrieval calls as read management events. These safeguards continue to provide protection and visibility if web request filtering fails.

SAP-C03

A financial services company runs three independently managed web applications in one VPC. Each application has a dedicated internet-facing Application Load Balancer (ALB), EC2 application instances in private subnets, and an Amazon RDS database in isolated subnets. The application tiers share private subnets, and the databases share isolated subnets. No application requires connectivity to another application's resources.

Currently, all application instances and databases use a shared security group that allows all traffic from the VPC CIDR. An assessment finds that an attacker who exploits one application could connect directly to the other applications and databases. Moving resources to different subnets or VPCs is not permitted during the remediation window.

The company requires a design that blocks common malicious HTTP requests before they reach application instances, prevents a compromised instance from establishing connections to another application's instances or database, and records accepted and rejected network flows for investigation. Legitimate ALB-to-application and application-to-database connections must continue to work. The design must assume that some attacks can evade HTTP request filtering.

Which solution meets these requirements?

Show answerCORRECT ANSWER

Associate an AWS WAF web ACL with each ALB. Replace the shared security group with separate ALB, application, and database security groups for each application. Permit application ingress only from its ALB security group on required ports and database ingress only from its application security group on the database port. Remove other workload ingress permissions. Enable VPC Flow Logs for accepted and rejected traffic.

This combines application-layer filtering, independent workload-level segmentation, and network visibility. Dedicated security groups prevent a compromised instance from initiating connections to another application's instances or database, even if an exploit evades AWS WAF. Security group references preserve the required communication paths, and stateful filtering permits their return traffic. VPC Flow Logs provide connection metadata for investigation.

AIP-C01

A company exposes an internal generative AI assistant through an Amazon API Gateway REST API. A Lambda authorizer verifies user identity. A backend independently checks the user's current document entitlements, invokes a foundation model, and validates the answer against the currently active output-safety policy before returning it. The backend withholds answers if any required check fails.

The GET /answer method has API Gateway stage caching enabled, with the question query parameter as its only cache key. Security testing shows that a cached answer can reach another user without the backend running. Document entitlements and safety policies can change at any time, even while a user's authentication token remains valid.

The company requires every answer delivery to pass the backend's current entitlement and output-safety checks. Other API methods must retain their existing caching configuration. Which change BEST meets these requirements?

Show answerCORRECT ANSWER

Disable API Gateway caching for GET /answer by using a method-level override, and flush existing stage cache entries as part of the change. Leave caching enabled for the other methods.

Disabling integration-response caching for this method ensures that each request reaches the backend for current entitlement and output-safety checks. Flushing removes existing cached answers during the transition. A method-level override preserves the other methods' caching configuration, although the one-time stage cache flush also clears their existing entries.

Practice Defense in Depth in a full exam

Questions on Defense in Depth in each practice exam, with every answer option and an explanation for each:

Start a free practice exam

What is Defense in Depth

3 min read

Defense in Depth assumes that individual security controls can fail, be bypassed, or be misconfigured. Instead of relying on a perimeter firewall alone, an architecture combines controls that address different attack paths and failure modes. For example, an internet-facing application might use distributed denial-of-service protection, HTTP request filtering, restricted origin access, workload-level network rules, application authorization, and database permissions. If an attacker bypasses request filtering, authorization and data-access controls still constrain what the attacker can do.

Cloud network segmentation applies this principle by separating resources according to trust, sensitivity, and required communication. North/south traffic crosses a defined environment boundary, such as traffic between the internet and an application. East/west traffic moves between internal workloads, such as an application server connecting to a database. These directions are relative to the architectural boundary being discussed. Protecting only internet ingress leaves lateral movement paths available after a workload is compromised.

A practical three-tier design places public entry points in internet-facing subnets, application workloads in private subnets, and databases in isolated subnets. Only the entry point can reach the application port, and only the application tier can reach the database port. An isolated subnet has no route to an internet gateway or NAT gateway, but it is not automatically disconnected from other internal networks. Local routes, transit connections, endpoints, and resource-level rules still determine possible communication. A subnet boundary by itself does not enforce isolation.

On AWS, security groups provide stateful, resource-level filtering, while network ACLs provide stateless subnet-boundary filtering. Network ACL rules must account for return traffic, including applicable ephemeral ports. Security groups can restrict permitted connections between application tiers; subnet ACLs can provide broader boundary restrictions. Neither replaces application authorization. Where centralized network inspection is required, routing must actually steer the relevant traffic through the firewall. Stateful inspection also requires a supported symmetric traffic path, including during failover.

Edge controls should match anticipated threats. Volumetric attacks call for distributed infrastructure and DDoS defenses; malicious HTTP requests call for application-layer filtering; abusive request rates may require rate limits or bot controls. A web application firewall does not inspect arbitrary non-HTTP protocols and cannot replace secure application code. A CDN does not prevent attackers from contacting a publicly reachable origin unless origin access is restricted separately. Use private origin connectivity where supported, or combine network restrictions and origin request validation to prevent direct-origin bypass.

Defense also extends to outbound connections, administrative access, and data access. Restrict unnecessary egress to reduce command-and-control and exfiltration paths, use narrowly scoped workload identities, and authenticate administrative sessions independently of network location. Encryption protects confidentiality but does not stop an authorized, compromised workload from reading data it is permitted to access. Network flow records, firewall logs, application logs, and identity audit events provide complementary evidence for detection and investigation.

Additional layers introduce cost, latency, operational complexity, and potential availability failures. Select controls for explicit threats rather than duplicating the same rule everywhere without a purpose. During troubleshooting, trace DNS resolution, routing, inspection paths, network rules, and application decisions in sequence; a timeout alone does not identify the blocking layer. Test expected connections, prohibited connections, origin-bypass attempts, and failure scenarios. The goal is independent protection with manageable operations, not the largest possible number of security products.

Learn Defense in Depth in lessons

5 short lessons on Defense in Depth in 5 certification courses.

Open the lessons