SkillSprout
Chapter 9 · Lesson 4
Advanced
6 min read

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

SymptomFirst checksTypical root cause
Instances launch then terminateASG activity history, target health, system logFailing health check, missing instance profile, wrong AMI, no capacity in AZ
ECS task stuck PENDINGService events, describe-tasks stoppedReasonNo capacity, ENI limit, image pull failure (no NAT or endpoint), missing secrets permission
Pod CrashLoopBackOffkubectl logs --previous, describe podBad config, failing probe, OOMKilled, missing IAM role for service account
Connection timeoutReachability Analyzer, flow logsSecurity group, NACL, route table, missing endpoint
502/504 from ALBTarget health, access logs, idle timeoutApplication crash, timeout mismatch, unhealthy targets
AccessDeniedCloudTrail event errorCode, policy simulator, Access AnalyzerSCP, boundary, resource policy or KMS key policy deny
CloudFormation rollbackStack events, first failed resourceMissing permission, quota, dependency or invalid property
ThrottlingCloudWatch service metrics and Service QuotasLimit reached, hot partition, lack of backoff

Investigation toolkit

bash
# 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

  1. Find the denied call in CloudTrail (errorCode, errorMessage; recent messages state if an explicit deny came from an SCP or a resource policy).
  2. 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.
  3. For KMS errors, check the key policy and grants as well as IAM.
  4. 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

  1. Build a timeline from CloudTrail, deployments, alarms and logs.
  2. State impact and detection time (MTTD) and recovery time (MTTR).
  3. Apply 5 whys until you reach a systemic cause, not a person.
  4. Define corrective actions: a test, an alarm, a guardrail (SCP, Config rule), a runbook update.
  5. 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

Evidence-driven troubleshooting
Architecture
AWS Cloud
Alarm / symptom
CloudTrailWhat changed
Config timelineBefore / after
Reachability / logsTest hypothesis
Incident ManagerRCA actions

From symptom to timeline to root cause and prevention.

  1. 1An alarm or user report identifies the symptom and time.
  2. 2CloudTrail and deployment history show what changed.
  3. 3Config timeline confirms resource state before and after.
  4. 4Reachability Analyzer, flow logs and application logs test hypotheses.
  5. 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