Protect an application in layers
Match each threat to the control that authenticates, stores, filters, prevents, detects, or responds—then close paths that bypass those controls.
LESSON GOALS
By the end, you can
- Match consumer identity, workforce identity, secret storage, filtering, DDoS protection, and detection to different needs.
- Design an edge-to-origin path that cannot bypass request filtering and has an owner for every finding.
01
Name the caller, threat, and control job
Start with verbs, not product names. Do you need to authenticate a caller, authorize an action, store and rotate a secret, filter a request, absorb a denial-of-service attack, detect suspicious behavior, classify data, or remediate a finding?
One service rarely performs all those jobs. A detector can report suspicious activity without blocking it. A network rule can allow a port without understanding a malicious HTTP request.
Also classify the caller. Employees administering AWS accounts are workforce identities. Software running on AWS is a workload identity. Shoppers signing in to an application are consumer identities.
For every threat, name the preventive control, detective control, and team that responds. This exposes gaps that a long service list hides.
Write one sentence for each threat: who acts, which asset is targeted, and what failure must be prevented or detected. That sentence gives each control a testable job.
02
Keep identity and secrets out of application code
Amazon Cognito user pools can manage consumer sign-in and issue application tokens. IAM Identity Center is for workforce access to AWS accounts and applications. Do not create IAM users and long-lived AWS keys for millions of shoppers.
A workload should use its AWS role instead of an embedded access key. The role may retrieve a database credential from Secrets Manager or encrypted configuration from Parameter Store.
Secrets Manager fits when credential lifecycle and rotation matter. Parameter Store SecureString can fit encrypted configuration when native credential rotation is not decisive.
Secret storage does not authorize application behavior. The workload role still needs narrow permission, and the application still decides what its signed-in customer may do.
Rotation needs runtime behavior. The application must fetch or refresh the current value and report failed rotation before the old credential is removed.
Keep application authorization separate from sign-in. A valid customer token proves identity, but the API must still check whether that customer may read or change the requested record.
03
Layer the edge, origin, detection, and response
CloudFront can provide the HTTP edge. AWS WAF can inspect supported HTTP and HTTPS requests, including SQL-injection patterns. Parameterized application code is still required because WAF is not a code fix.
The origin must reject direct callers. If an internet client can call the load balancer without passing through CloudFront and WAF, the edge controls are bypassed.
Shield Standard provides baseline DDoS protection. Shield Advanced adds enhanced capabilities when an explicit need justifies it; neither replaces WAF, identity, secure code, or origin restrictions.
GuardDuty reports suspicious activity, Macie discovers sensitive S3 data, and Inspector finds supported compute vulnerabilities and exposure. These services produce findings; they do not repair workloads.
Assign every finding a triage owner and tested response. Detection without response is only a notification.
Test the bypass explicitly by sending one request to CloudFront and one to the origin address. The protected path should work; the direct path should fail before the application handles it.
DECISION TABLE
Compare the architecture constraints
GUIDED WORKED SCENARIO
Reason from the stated constraints
This is a guided example, not a question to memorise. The knowledge check uses new situations to test the same reasoning.
A public API serves two million customers through CloudFront to a private origin. It needs DDoS resilience, SQLi filtering, no origin bypass, social login, rotating DB secret, threat detection, and discovery of sensitive S3 files.
Requirements
- Consumer identity.
- Only edge path reaches origin.
- HTTP filtering + DDoS baseline.
- Secret rotates without rebuild.
- Detection is not prevention.
Reasoning path
- Use Cognito and app authorization.
- Use CloudFront/WAF and restrict origin.
- Use AWS Shield Standard; Advanced only if justified.
- Retrieve rotating secret through role.
- Use GuardDuty and Macie with response owners.
Why it wins
- Each control maps to a threat/verb.
- Origin restriction closes bypass.
- Identity/secret lifecycle avoids embedded keys.
Why the alternatives lose
No HTTP inspection, app identity, rotation, or classification.
Becomes correct when: Only port/source allow is needed.Does not replace WAF/identity/origin/secrets.
Becomes correct when: Enhanced DDoS is sole extra need beside existing controls.Massive long-lived AWS identities.
Becomes correct when: Not preferred; exceptional IAM population only.INTERACTIVE ARCHITECTURE VISUAL
Close the edge-bypass path
A customer calls an API through CloudFront. Keep request filtering, origin restriction, and detection response separate.
× Request stopsA direct caller bypasses CloudFront and WAF through the public origin.
Read the diagram as text
Trace a customer request through Cognito sign-in → CloudFront → WAF → restricted origin → application. A direct-origin request must fail. Separately map the workload role to Secrets Manager and every GuardDuty or Macie finding to a response owner.
KNOWLEDGE CHECK
Answer one question at a time
Pass every question to complete this lesson. Each answer includes reasoning before you continue.
KEY TERMS
Glossary
- Consumer identity
- A person signing in to an application rather than administering AWS.
- Cognito user pool
- A directory and token service for application users.
- AWS WAF
- A web application firewall for supported HTTP and HTTPS requests.
- Origin
- The server or load balancer behind an edge service.
- Origin bypass
- A direct path to the origin that avoids intended edge controls.
- AWS Shield
- AWS protection focused on distributed denial-of-service attacks.
- Secrets Manager
- A service for storing secrets and supporting rotation.
- GuardDuty
- A threat-detection service that produces findings.
- Inspector
- A service that scans supported compute resources for vulnerabilities and exposure.
PRIMARY SOURCES
Verify the claims
- primarySecurity Pillar – AWS Well-Architected Frameworkaws-wa-security-pillar · retrieved 2026-07-29
- primaryContent Domain 1: Design Secure Architecturesaws-cert-saa-c03-domain-1 · retrieved 2026-07-30
- primaryAmazon Cognito user poolsaws-cognito-user-pools · retrieved 2026-07-30
- primaryAmazon Cognito identity poolsaws-cognito-identity-pools · retrieved 2026-07-30
- primaryWhat is AWS Secrets Manager?aws-sec-secrets · retrieved 2026-07-29
- primaryAWS Systems Manager Parameter Storeaws-systems-manager-parameter-store · retrieved 2026-07-30
- primaryWhat is Amazon CloudFront?aws-net-cloudfront · retrieved 2026-07-29
- primaryWhat is AWS WAF?aws-sec-waf · retrieved 2026-07-29
- primaryHow AWS Shield and Shield Advanced workaws-shield-how-it-works · retrieved 2026-07-30
- primaryWhat is Amazon GuardDuty?aws-guardduty-overview · retrieved 2026-07-30
- primaryWhat is Amazon Macie?aws-macie-overview · retrieved 2026-07-30
- primaryCloudfront Restrict Albaws-cloudfront-restrict-alb · retrieved 2026-07-30
- primaryInspector Overviewaws-inspector-overview · retrieved 2026-07-30