Trigger: Service is experiencing unusually high traffic volumes causing degraded performance or unavailability.
Owner: On-call engineer Severity: P1 (service down) / P2 (degraded)
Check CloudWatch metrics:
# Lambda: request count spike
aws cloudwatch get-metric-statistics \
--namespace AWS/Lambda \
--metric-name Invocations \
--period 60 --statistics Sum \
--start-time $(date -u -d '30 minutes ago' +%Y-%m-%dT%H:%M:%SZ) \
--end-time $(date -u +%Y-%m-%dT%H:%M:%SZ) \
--dimensions Name=FunctionName,Value=<FUNCTION_NAME>
# CloudFront: request rate
aws cloudwatch get-metric-statistics \
--namespace AWS/CloudFront \
--metric-name Requests \
--period 60 --statistics Sum \
--start-time $(date -u -d '30 minutes ago' +%Y-%m-%dT%H:%M:%SZ) \
--end-time $(date -u +%Y-%m-%dT%H:%M:%SZ)Differentiate DDoS from legitimate traffic spike:
- DDoS: requests from single/few IPs, unusual user-agents, no session cookies, hitting non-existent endpoints
- Legitimate spike: distributed IPs, real user agents, normal endpoint distribution
# Add a rate-based rule blocking IPs with >1000 req/5min
aws wafv2 create-rule-group --scope CLOUDFRONT --name ddos-emergency \
--capacity 100 --visibility-config ...# Block specific attacker IP ranges
aws ec2 authorize-security-group-ingress \
--group-id <SG_ID> \
--protocol tcp --port 443 \
--cidr <ATTACKER_CIDR> \
--description "DDoS block $(date +%Y-%m-%d)"Wait — security groups are ALLOW lists, not deny lists. Use NACLs to block:
# Block at NACL level (evaluated before security groups)
aws ec2 create-network-acl-entry \
--network-acl-id <NACL_ID> \
--rule-number 100 \
--protocol -1 \
--rule-action deny \
--ingress \
--cidr-block <ATTACKER_CIDR># Set reserved concurrency to limit Lambda scale
aws lambda put-function-concurrency \
--function-name <FUNCTION_NAME> \
--reserved-concurrent-executions 50If attacks are sustained and large-scale, engage AWS Shield Advanced:
- Go to AWS Shield console
- Enable Shield Advanced (if not already enabled)
- Contact AWS DDoS Response Team (DRT): available 24/7 to Shield Advanced customers
# Watch CloudFront 5xx error rate
watch -n 10 aws cloudwatch get-metric-statistics \
--namespace AWS/CloudFront --metric-name 5xxErrorRate \
--period 60 --statistics Average \
--start-time $(date -u -d '5 minutes ago' +%Y-%m-%dT%H:%M:%SZ) \
--end-time $(date -u +%Y-%m-%dT%H:%M:%SZ)- Document attacker characteristics (IPs, ASNs, user-agents, request patterns)
- Enable WAF permanently with rate-based rules (see NET-001 recommendation)
- Enable AWS Shield Standard (free, always-on) at minimum for CloudFront distributions
- Consider Shield Advanced for production workloads
- Set up CloudWatch alarm for request rate spikes (>10x baseline)
- Remove temporary NACL/SG blocks once attack subsides