Root cause analysis
DVA-C03 · Lesson 21 of 24 · 2:56:01
YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗
Learning with these videos? Subscribe for new courses and exam-style questions.
Subscribe on YouTube (opens in a new tab)In this lesson
Prepare for the DVA-C03 exam (AWS Certified Developer – Associate). In this lesson: reading symptoms (AccessDenied, timeouts, 502, 504, 429), Lambda and API Gateway metrics, the REPORT line, X-Ray traces, CloudWatch Logs Insights queries, failed deployments in CloudFormation, CodeBuild, CodeDeploy, and ECS, and AI-assisted investigations. Includes three original practice questions.
Study notes
The text of this lesson, to read at your own pace. Information as of November 2026.
Friday night errors
On a Friday night at AnyCompany Tickets, the checkout started to fail for one fan in twelve. The dashboards showed a rise in 5XX errors, the logs held millions of lines, and a deployment had gone out at six. This lesson covers debugging, metrics and traces, Logs Insights queries, failed deployments, and AI tools for troubleshooting.
Debugging defects
Start from the symptom, then follow the request. An AccessDenied error points to a missing permission, in the role of the caller or in a resource policy. A task that timed out is waiting on something: a slow dependency, a timeout set too short, or a function in a VPC with no route to the service that it calls. In API Gateway, a 502 often means that the proxy response of the function is malformed, a 504 that the integration took longer than twenty-nine seconds, and a 429 means throttling. And reproduce the defect with the same event, locally or in a test stack, before you change the code.
Metrics
Metrics show where and when. For Lambda, watch invocations, errors, throttles, the duration with its percentiles, concurrent executions, and the iterator age of a stream, which grows when the function falls behind. For API Gateway, watch the 4XX and 5XX errors, and compare the latency with the integration latency, to see whether the time goes to API Gateway or to the backend. And the REPORT line of each invocation gives its duration, the duration that is charged, the memory size, the maximum memory used, and the init duration of a cold start.
Traces
An X-Ray trace follows one request across services, with a segment for each service and a subsegment for each call, like a DynamoDB query. The trace map highlights the nodes with errors or high latency. And annotations, indexed key-value pairs, let you filter traces, like every request for one event.
Logs Insights
CloudWatch Logs Insights queries log groups with a pipe syntax. The fields command picks the fields, filter keeps the matching events, stats aggregates them, sort and limit order the results, and parse pulls values out of text. Lambda logs come with discovered fields, like the request ID, the duration, and the maximum memory used, and structured JSON logs make every field of your own events usable in a query. You can also write a query in natural language, group events into patterns, or compare a time window with an earlier one. And a query scans only the log groups and the time range that you choose.
Failed deployments
When a deployment fails, its output logs say why. In CloudFormation, the stack events show the first resource that failed and its status reason, before the rollback events that follow. CodeBuild keeps the log of each build phase, CodeDeploy shows each lifecycle event with the output of its hook scripts, and a stopped ECS task gives its stopped reason, like an image that cannot be pulled. So look for the first failure, not the last message.
AI for troubleshooting
AI tools speed up the analysis. A CloudWatch investigation, started from an alarm, a metric, or a Logs Insights query, scans metrics, logs, traces, deployment events, and CloudTrail changes, and suggests root-cause hypotheses that you accept or discard, with every action logged in CloudTrail. Kiro reads a stack trace or a failing log, explains the error, and proposes a fix in the code, and in a pipeline, Kiro CLI explains build failures. And a person checks each hypothesis before acting on it.
Recap
Let's recap. Debugging starts from the symptom: AccessDenied, timeouts, 502, 504, or 429, then reproduces the defect with the same event. Metrics show where and when, from errors and throttles to the iterator age and integration latency. X-Ray traces show which call is slow or failing, and Logs Insights queries filter, count, and parse the logs. Failed deployments are explained by stack events, build logs, lifecycle events, and stopped reasons. And CloudWatch investigations and Kiro suggest causes and fixes, which people check.
Quick checks for this lesson
The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.
A function reads a Kinesis stream. Its iterator age keeps rising, while its error count stays at zero. What does this show?
- Records are failing, then being retried
- The function is falling behind the stream
- The stream is throttling its producers
- The function runs out of memory
Show the answer
The function is falling behind the stream
The iterator age is the age of the last record processed, so a rising value means the function is falling behind. “Records are failing, then being retried” would show up in the error count, which stays at zero. “The stream is throttling its producers” would be about the writers of the stream, not about this function. And “The function runs out of memory” would end invocations with errors.
A developer needs the number of timeout errors per five minutes, over the last day, across all the logs of a function. What should the developer use?
- A search of each log stream in the console
- A longer retention period for the log group
- A data protection policy on the log group
- A Logs Insights query with filter and stats
Show the answer
A Logs Insights query with filter and stats
A Logs Insights query filters the timeout messages, and stats counts them in bins of five minutes. “A search of each log stream in the console” would mean opening log streams one by one. “A longer retention period for the log group” would keep the logs longer, without counting anything. And “A data protection policy on the log group” would mask sensitive data in the logs.
An alarm went off after a deployment. The developer on call wants hypotheses generated by AI, which connect the alarm with recent deployment events and CloudTrail changes, without writing any query. What should the developer use?
- A CloudWatch investigation from the alarm
- A steering file in the Kiro project
- A metric filter on the log group
- Logs Insights queries written by hand
Show the answer
A CloudWatch investigation from the alarm
A CloudWatch investigation started from the alarm scans the telemetry and the change events, and suggests hypotheses. “A steering file in the Kiro project” would guide the code that Kiro writes, without analyzing an incident. “A metric filter on the log group” would turn log events into a metric, without any hypothesis. And “Logs Insights queries written by hand” would mean writing the queries by hand.