Mastering Incident & Event Response: Troubleshooting System and Application Failures
Troubleshoot system and application failures
Mastering Incident & Event Response: Troubleshooting System and Application Failures
This guide covers Task Statement 5.3 of the AWS Certified DevOps Engineer Professional (DOP-C02) exam. It focuses on identifying, analyzing, and remediating failures within complex AWS environments using observability tools and structured troubleshooting methodologies.
Learning Objectives
After studying this guide, you should be able to:
- Differentiate between EC2 System and Instance status checks.
- Analyze failed deployments in AWS CodePipeline and CloudFormation.
- Utilize Amazon CloudWatch and AWS X-Ray for distributed root cause analysis (RCA).
- Evaluate health check configurations across ELB, Auto Scaling Groups, and Route 53.
- Remediate scaling issues and failed processes in Amazon ECS and EKS.
Key Terms & Glossary
- Root Cause Analysis (RCA): A systematic process for identifying the origin of a problem to determine the best solution and prevent recurrence.
- 5xx Errors: Server-side error codes (e.g., 502 Bad Gateway, 504 Gateway Timeout) indicating the backend failed to fulfill a valid request.
- Synthetic Monitoring: A method of monitoring applications by simulating user pathways and requests using "canaries."
- Grace Period: A configurable time during which Auto Scaling ignores health check results while an instance is booting up.
- Drift Detection: A CloudFormation feature that identifies if an existing resource's configuration has changed from its template definition.
The "Big Idea"
In a DevOps culture, troubleshooting is not just about "fixing"—it is about observability and automation. The goal is to move from reactive manual investigation to a proactive state where the system detects failures via health checks, analyzes them through aggregated logs/traces, and self-heals through automated recovery processes. Troubleshooting is the skill of navigating these layers of data to find the single point of failure.
Formula / Concept Box
| Health Check Component | Default / Key Rule | Use Case |
|---|---|---|
| EC2 Status Check | System vs. Instance | Identifying AWS-side vs. User-side issues |
| ALB Health Check | Must return a 200-399 range | Ensuring backend targets are ready for traffic |
| ASG Grace Period | Default: 300 seconds | Prevents premature termination of slow-booting apps |
| RTO / RPO | Recovery Time / Point | Metrics defining the success of disaster recovery |
Hierarchical Outline
- I. Monitoring & Observability Stack
- Amazon CloudWatch: Metrics (Performance), Logs (Detailed events), Synthetics (Canaries).
- AWS X-Ray: Distributed tracing for microservices and Lambda functions.
- CloudWatch Insights: Log searching and pattern matching for RCA.
- II. Health Evaluation Mechanisms
- EC2 Status Checks: Hardware (System) vs. Software/OS (Instance).
- ELB/Target Groups: Active health checks via HTTP/TCP/HTTPS.
- Route 53: Health checks for DNS failover and endpoint monitoring.
- III. Failure Analysis Scenarios
- Failed Deployments: CodePipeline stage failures and CloudFormation Rollbacks.
- Compute Failures: ECS task crashes and EKS pod pending states.
- Security Failures: IAM Permission Boundaries and SCP-induced "Access Denied."
Visual Anchors
Deployment Failure Analysis Flow
Elastic Load Balancer Health Check Logic
Definition-Example Pairs
- Instance Status Check: Monitors the software and network configuration of an individual instance.
- Example: An instance fails this check if the operating system crashes or if there is a misconfigured firewall (Security Group/NACL) blocking ARP requests.
- System Status Check: Detects underlying hardware or infrastructure problems managed by AWS.
- Example: A loss of network connectivity to the physical host or a hardware failure on the host rack.
- CloudWatch Metric Filter: A feature that extracts metric data from log files.
- Example: Creating a filter to count the occurrences of the string "ERROR" in application logs and triggering an SNS alert if it exceeds 5 in one minute.
Worked Examples
Scenario: The "Flapping" Auto Scaling Instance
Problem: A new instance is launched by an ASG, but it is terminated 5 minutes later, and the cycle repeats.
Step-by-Step Breakdown:
- Check ASG Activity History: See the reason for termination. It says "Instance failed ELB health checks."
- Verify Grace Period: Check the ASG configuration. The
HealthCheckGracePeriodis set to 60 seconds. - Monitor App Startup: The application takes 180 seconds to download dependencies and start the web server.
- Root Cause: The ELB starts checking health at 60 seconds. The app isn't ready, so it reports "Unhealthy." The ASG replaces it before it can ever finish starting.
- Solution: Increase the
HealthCheckGracePeriodto 300 seconds to allow for variation in boot time.
Checkpoint Questions
- What is the difference between a 502 (Bad Gateway) and a 504 (Gateway Timeout) when troubleshooting an ALB?
- Which service would you use to trace a request across multiple microservices to find a latency bottleneck?
- If an instance passes an EC2 status check but fails an ELB health check, is the issue likely with AWS infrastructure or the application?
- How does a CloudFormation "Rollback" help in a failed deployment scenario?
- What role does the
SSM Agentplay in troubleshooting managed EC2 instances?
Muddy Points & Cross-Refs
- Grace Period vs. Lifecycle Hooks: Users often confuse these. A Grace Period is just a timer for health checks. A Lifecycle Hook actually pauses the instance state (e.g.,
Pending:Wait) to allow for custom initialization scripts to run. - CloudWatch Logs vs. CloudTrail: Remember: CloudTrail is for WHO did WHAT (API calls), while CloudWatch Logs is for WHAT happened inside the app/OS.
- EKS Troubleshooting: If a pod is in
Pendingstate, check for resource constraints or node affinity. If it's inCrashLoopBackOff, check the container logs (kubectl logs).
Comparison Tables
System vs. Instance Status Checks
| Feature | System Status Check | Instance Status Check |
|---|---|---|
| Failure Cause | AWS Hardware / Power / Network | OS Crash / Network Config / Driver Issue |
| Responsibility | AWS (Shared Responsibility Model) | You (The Customer) |
| Resolution | Wait for AWS or stop/start instance | Reboot instance or modify OS config |
| Detection Method | Host-level hardware monitoring | ARP requests to the ENI |
Monitoring Tool Comparison
| Tool | Best Used For | Key Data Type |
|---|---|---|
| CloudWatch Metrics | Threshold-based alerting | Numeric time-series |
| CloudWatch Logs | Deep-dive post-mortem analysis | Text/JSON events |
| AWS X-Ray | Identifying microservice latency | Segment Traces |
| AWS Health | AWS-wide service disruptions | Event Notifications |