Troubleshooting Failed Workloads and Root Cause Analysis
Overview
DOP-C02 task 5.3 asks you to troubleshoot system and application failures and perform root cause analysis. The exam gives symptoms (instances launching and terminating, tasks stuck PENDING, deployments rolling back, connection timeouts) and asks which evidence to inspect or what the single most probable cause is.
Think of a detective. Start from the symptom, collect timestamps from several witnesses (metrics, logs, traces, CloudTrail, Config history), build a timeline and test one hypothesis at a time, then prevent the cause from recurring.
The skill is knowing which AWS tool holds which evidence, and using managed tools (Session Manager, Reachability Analyzer, Config timeline) instead of ad hoc access.
Key Concepts
- Always begin with what changed: CloudTrail (who and when), Config resource timeline (what), CloudFormation events and CodeDeploy deployment logs (deployment).
- Compare layers: DNS, network path, security groups and NACLs, load balancer, target health, OS, application, dependencies.
- VPC Reachability Analyzer and Network Access Analyzer verify paths without sending traffic; VPC Flow Logs show ACCEPT or REJECT.
- Session Manager gives audited shell access with no SSH; Run Command collects logs from many instances.
- ASG launch loops: read activity history, then check the launch template (AMI, role, key, security group), subnet capacity and ELB health check grace period.
- ECS task issues: stopped reason in the console or
describe-tasks; EKS:kubectl describe pod, events, node group health and IRSA or Pod Identity roles. - Incident Manager and OpsCenter coordinate response, with post-incident analysis capturing timeline and action items.
- Use blameless RCA (5 whys, contributing factors) and convert findings into alarms, tests and guardrails.
Detailed Notes
Symptom to evidence map
| Symptom | First checks | Typical root cause |
|---|---|---|
| Instances launch then terminate | ASG activity history, target health, system log | Failing health check, missing instance profile, wrong AMI, no capacity in AZ |
| ECS task stuck PENDING | Service events, describe-tasks stoppedReason | No capacity, ENI limit, image pull failure (no NAT or endpoint), missing secrets permission |
| Pod CrashLoopBackOff | kubectl logs --previous, describe pod | Bad config, failing probe, OOMKilled, missing IAM role for service account |
| Connection timeout | Reachability Analyzer, flow logs | Security group, NACL, route table, missing endpoint |
| 502/504 from ALB | Target health, access logs, idle timeout | Application crash, timeout mismatch, unhealthy targets |
| AccessDenied | CloudTrail event errorCode, policy simulator, Access Analyzer | SCP, boundary, resource policy or KMS key policy deny |
| CloudFormation rollback | Stack events, first failed resource | Missing permission, quota, dependency or invalid property |
| Throttling | CloudWatch service metrics and Service Quotas | Limit reached, hot partition, lack of backoff |
Investigation toolkit
# Who changed the security group?
aws cloudtrail lookup-events --lookup-attributes AttributeKey=ResourceName,AttributeValue=sg-0abc123 --max-results 10
# What did the resource look like before the incident?
aws configservice get-resource-config-history --resource-type AWS::EC2::SecurityGroup --resource-id sg-0abc123 --limit 5
# Why is this path blocked?
aws ec2 create-network-insights-path --source i-0aaa --destination i-0bbb --protocol tcp --destination-port 5432
aws ec2 start-network-insights-analysis --network-insights-path-id nip-0123
# Why did tasks stop?
aws ecs describe-tasks --cluster prod --tasks <task-id> --query 'tasks[].{reason:stoppedReason,containers:containers[].reason}'
AccessDenied triage order
- Find the denied call in CloudTrail (errorCode, errorMessage; recent messages state if an explicit deny came from an SCP or a resource policy).
- Evaluate in order: explicit deny anywhere (SCP, boundary, session policy, identity or resource policy), then an allow in both the SCP/boundary and the identity or resource policy. Cross-account calls need allows on both sides.
- For KMS errors, check the key policy and grants as well as IAM.
- Use the IAM policy simulator and Access Analyzer policy validation to confirm.
Failed deployment and application incidents
- CodeDeploy: read
/opt/codedeploy-agent/deployment-root/.../scripts.log, and the event that failed (BeforeInstall, ValidateService). - Elastic Beanstalk: request logs,
eb-engine.log, and enhanced health causes. - Lambda: check Errors, Throttles, Duration and IteratorAge, then logs; for timeouts in a VPC check NAT or endpoints.
- Database slow: Performance Insights, slow query logs, connection counts and RDS Proxy.
- Memory leak or saturation: CloudWatch agent metrics, Container Insights, DevOps Guru anomalies.
Root cause analysis method
- Build a timeline from CloudTrail, deployments, alarms and logs.
- State impact and detection time (MTTD) and recovery time (MTTR).
- Apply 5 whys until you reach a systemic cause, not a person.
- Define corrective actions: a test, an alarm, a guardrail (SCP, Config rule), a runbook update.
- Record in Incident Manager's post-incident analysis and track actions to completion.
Preventing repeats
Add synthetic canaries, tighten health checks and rollback alarms in pipelines, enforce IaC drift detection and run FIS experiments for the failure you just experienced.
Real World Example
Scenario: after a Friday release, ECS tasks keep stopping with "CannotPullContainerError" and the service never reaches steady state. The engineer checks stoppedReason, finds that image pulls time out, and uses Reachability Analyzer from the task ENI to ECR. The private subnet's route to the NAT gateway had been removed by a network stack update.
CloudTrail identifies the change set that deleted the route, Config history confirms the previous state, and the fix is a template correction plus an ECR interface and S3 gateway endpoint for resilience. The RCA adds a Config rule for default routes and an alarm on pending tasks.
Architecture Diagram
From symptom to timeline to root cause and prevention.
- 1An alarm or user report identifies the symptom and time.
- 2CloudTrail and deployment history show what changed.
- 3Config timeline confirms resource state before and after.
- 4Reachability Analyzer, flow logs and application logs test hypotheses.
- 5RCA actions become alarms, tests and guardrails.
Best Practices
- ✓Start every investigation with what changed, using CloudTrail and Config history.
- ✓Give operators Session Manager and read-only roles, not SSH keys or admin.
- ✓Use Reachability Analyzer before changing security groups at random.
- ✓Run blameless post-incident reviews and track corrective actions.
- ✓Automate recurring diagnostics as SSM Automation runbooks.
Common Interview Questions
Exam Tips
DOP-C02 focus
- "Which API call changed the resource?" = CloudTrail; "what did it look like" = Config.
- "Verify network path without traffic" = VPC Reachability Analyzer.
- "Task cannot pull image in private subnet" = NAT or VPC endpoints for ECR and S3.
- "Shell access without SSH and with logs" = Session Manager.
Finished this lesson?
0 of 44 lessons done · 0% of the course

