AWS for developers · senior
Finding failures and cost surprises
With only CloudWatch you can still find a failing path with structured logs and Logs Insights, and you can find a cost jump with Cost Explorer, tags and anomaly detection.
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceThe notes
What you must know
- Structured JSON logs to stdout with a request id, order id, route, status, latency and the gateway error code. The awslogs driver or FireLens sends them to a log group.
- Logs Insights: filter errors on the payments route and use stats count(*) by errorCode, bin(5m). Then group by @logStream (one per task) to see whether failures cluster on some tasks.
- Clustering by task, subnet or zone points at the network path. One example: a NAT gateway in one zone runs out of source ports because the HTTP client opens a new connection per call. Fix with connection reuse (a keep-alive pool) first, then more NAT addresses if needed.
- Make metrics from logs with a metric filter, alarm on the error ratio, and add X-Ray or OpenTelemetry traces for the slow path.
- Cost jump after a release: Cost Explorer by service, then usage type, then cost allocation tags (service, team). Cost Anomaly Detection shows when it started.
- A DynamoDB Scan reads the table page by page and you pay for every item read, not for the few the filter returns. Design for the access pattern: a GSI and Query with a limit. For free-text search use a search index fed from DynamoDB Streams.
- CloudWatch custom metrics: each unique combination of name and dimensions is a separate metric billed per month. Never use user ids as dimensions. Also check log volume and retention settings.
- Set budgets and alerts, and add tags before you need them.
The red pen
Common traps: mistake → fix
Mistake: The Scan filter returns only a few items so it is cheap
Fix: You pay for everything read.
Mistake: Metrics with user id dimensions help debugging
Fix: Each id is a new billed metric. Use logs for ids.
Mistake: Errors on all tasks means the code is broken
Fix: Errors on some tasks or one zone often mean a network or capacity problem.
Easy to hard
Questions interviewers ask, easy to hard
- How do you find which payments fail using only CloudWatch?
- Failures cluster on a few tasks. What does that suggest?
- How do you find what raised the bill after a release?
- Why can a DynamoDB Scan be expensive?
- Why can custom metrics with many dimensions be expensive?
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceYour first interview is free
Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.