Key principle
Each layer provides independent protection. A request must pass through every layer. If one layer is bypassed or compromised, subsequent layers still enforce security. Continuous detection services monitor across all layers simultaneously.
Policy evaluation at identity layer: explicit deny → SCP boundary → permission boundary → identity ∩ resource policy intersection. Deny at any point = denied.
WAF actions
BLOCK — 403. ALLOW — pass. COUNT — log only (test before enforcement). CAPTCHA — challenge. Challenge — silent JS challenge. Deploy new rules in COUNT → analyze logs → flip to BLOCK.
Web ACL budget: 5,000 WCU. Core Rule Set ~700 WCU. Rules consume WCU so you can't stack unlimited groups.
Shield standard vs advanced
Shield Advanced critical detail
Shield Advanced requires Route 53 health checks on protected resources. Without health checks, it can't distinguish DDoS from legitimate traffic spikes.
CloudFront security features
TLS termination — ACM free certs, TLS 1.2/1.3, TLSv1.2_2021 policy. Origin Access Control (OAC) — replaces OAI, IAM-based S3 auth, supports SSE-KMS. Signed URLs/cookies — RSA key pairs in Key Groups. Geo restrictions — binary allow/deny by country. Field-level encryption — encrypt POST fields at edge with your public key.
NACLs vs security groups
Ephemeral port gotcha
NACLs are stateless: allow inbound 443, but response goes back on random port 1024-65535. Outbound rules must allow that range. SGs don't have this problem — stateful means return traffic auto-allowed.
PrivateLink vs VPC peering vs Transit Gateway
PrivateLink — service-level private access across accounts (one-directional, no IP overlap, per-service).
VPC peering — bidirectional VPC-to-VPC (non-transitive, no CIDR overlap).
Transit Gateway — hub-and-spoke across many VPCs and on-prem (transitive, centralized routing, supports overlapping CIDRs via route tables).
Trust policy scoping
Scope to org + branch + environment. Add environment claim for prod. Use
sts:TagSession to carry repo/SHA into CloudTrail.
ABAC vs RBAC
ABAC condition keys
aws:PrincipalTag — tags on caller. aws:ResourceTag — tags on target.
aws:RequestTag — enforce at creation. aws:TagKeys — prevent tag
escalation.
KMS envelope encryption
CMK stored in HSMs, never leaves KMS unencrypted. GenerateDataKey returns plaintext DEK + encrypted DEK. Plaintext DEK encrypts data, then discarded. To decrypt: send encrypted DEK to KMS → get plaintext DEK → decrypt data.
Key policies control access. Automatic annual rotation (old versions retained). Grants for temporary scoped access.
S3 encryption options
SSE-S3: AWS manages keys. AES-256. Default. No audit trail. SSE-KMS: KMS CMK. CloudTrail logs every operation. $0.03/10K requests. SSE-C: You provide key per request. Rare use case.
Enforce: deny PutObject without x-amz-server-side-encryption: aws:kms header.
Secrets Manager
KMS-encrypted. Auto-rotation via Lambda for RDS/Redshift/DocumentDB. Version staging labels (AWSCURRENT, AWSPENDING, AWSPREVIOUS) for zero-downtime rotation. Cross-account via resource policy. EKS integration via External Secrets Operator or CSI driver.
TLS in transit
ACM free public certs + auto-renewal. Private CA via ACM PCA. CloudFront: TLS 1.2/1.3 at edge.
ALB: termination + re-encrypt. EKS: service mesh mTLS. Enforce aws:SecureTransport
in bucket policy.
GuardDuty
Analyzes CloudTrail, VPC flow logs, DNS logs via ML + threat intel. Finding types: reconnaissance, instance compromise (C&C), account compromise. EKS audit log monitoring for K8s threats. S3 protection for unusual data access.
AWS Config
Records config changes. ~300+ managed rules. Conformance packs (PCI-DSS, CIS). Auto-remediation via SSM Automation. Cross-account aggregator for compliance dashboard.
Security Hub
Single pane: normalizes findings from GuardDuty, Config, Inspector, Macie, IAM Access Analyzer into ASFF. Security score per standard. Custom actions → EventBridge.
Automated remediation pattern
GuardDuty detects compromised EC2 → EventBridge rule → Lambda → removes from all SGs → attaches forensic SG → takes EBS snapshot → sends SNS alert. Total time: under 60 seconds.