Learning Objectives
By the end of this chapter, you will be able to:
- Use logs and metrics to distinguish between an application issue and a deployment issue, and pick the right cache layer among Amazon API Gateway, Amazon CloudFront, Amazon DynamoDB Accelerator (DAX), and Amazon ElastiCache.
- Identify common HTTP error codes returned by AWS services and tune concurrency through AWS Lambda provisioned concurrency, Amazon ECS service auto scaling, and Amazon Kinesis Data Streams shards.
- Read IAM and networking permission failures out of CloudTrail, VPC Flow Logs, and service logs.
- Analyze code paths with AWS X-Ray annotations, metadata, and error capture.
- Configure Amazon CloudWatch Application Insights to surface workload-level signals.
- Separate the responsibilities of logging from those of monitoring in a production system.
- Emit structured logs with consistent fields so they are queryable in CloudWatch Logs Insights.
- Instrument application code to produce traces, custom metrics, and event data.
Executive Summary
- Deployment incidents and application incidents look similar in user-facing dashboards. The fastest way to separate them is to overlay a deployment timestamp on application metrics and to compare the failing call against the same call before the rollout.
- HTTP status codes from AWS service APIs follow a small set of patterns. A 4xx points at the caller (input, permissions, throttling against a soft quota), and a 5xx points at the service or a dependency it cannot reach.
- IAM and networking denials surface in different log streams: identity-based denials appear in CloudTrail and the service log, while networking denials appear in VPC Flow Logs and target-group health checks.
- X-Ray, Application Insights, and structured logs are complementary. Traces show the shape of a request, metrics show the trend, and logs hold the evidence.
- Cache and concurrency knobs are part of the troubleshooting toolbox. A query latency complaint may be solved by adding DAX in front of DynamoDB; a cold-start complaint may be solved by reserving provisioned concurrency on the critical Lambda function.
Assumptions
- The reader is familiar with the terminology established in earlier chapters, including event source mapping, reserved concurrency, provisioned concurrency, alias-weighted routing, DynamoDB Accelerator, Amazon ElastiCache, and the Lambda asynchronous retry model. These terms are not redefined here.
- Examples assume the AWS region is set in the environment, that the principal running the AWS CLI commands holds the matching permissions, and that all illustrative names (account IDs, table names, function names) are fictional.
