Visualising Application Health with Dashboards and CloudWatch Insights
This lesson explains how dashboards and the CloudWatch insight features show an application's health at a glance and help find where a problem started, across services, accounts and Regions.
Learning outcomes
After completing this lesson, you will be able to:
- Describe the CloudWatch features for seeing an application's state, such as dashboards and Lambda Insights.
- Explain how a useful operational dashboard is organised.
- Explain how Contributor Insights ranks the top contributors to errors or throttling.
Dashboards and insights
CloudWatch offers several features for seeing the state of an application at a glance and for drilling into a specific resource.
CloudWatch dashboards are customisable pages of widgets: graphs of metrics, the current state of alarms, results of Logs Insights queries and text. A single dashboard can show resources from several Regions. Cross-account observability links source accounts to a monitoring account, so that dashboards, alarms and queries in the monitoring account can use metrics, logs and traces from every linked account, which suits organisations with one account per team or environment.
Lambda Insights and Container Insights collect detailed resource metrics that the standard metrics omit: CPU time, memory and network use for each Lambda function, and CPU, memory, network and restarts for each ECS or EKS task, service and cluster. Contributor Insights analyses log events or DynamoDB traffic and ranks the top contributors, such as the client IP addresses with the most errors or the partition keys with the most throttled requests. The following table summarises the features.
| Feature | What it shows |
|---|---|
| CloudWatch dashboards | Metrics, alarms and Logs Insights queries across services and Regions |
| Cross-account observability | Metrics and logs from many accounts in one monitoring account |
| Lambda Insights, Container Insights | Detailed resource metrics for functions and containers |
| Contributor Insights | Top contributors to a pattern, such as the most-throttled DynamoDB keys |
Example. During an incident, count errors per service in five-minute buckets to see when a problem started:
fields @timestamp, service, message
| filter level = "ERROR"
| stats count(*) as errors by bin(5m), service
| sort errors descFind the slowest requests:
fields @timestamp, @requestId, @duration
| filter @type = "REPORT"
| sort @duration desc
| limit 20Which CloudWatch view?
Building useful dashboards
CloudWatch dashboards present metrics, alarms and logs in a single view. The following list describes how useful dashboards are built.
- Automatic dashboards exist for many services, such as Lambda and DynamoDB, with no setup.
- Custom dashboards can combine metric graphs, alarm status, Logs Insights query results and text, across Regions and, with cross-account observability, across accounts.
- Dashboards are defined as JSON, so they can be created with
PutDashboardor CloudFormation and kept in source control. - Dashboards can be shared with people who have no AWS account through a link or SSO.
- A good service dashboard shows request rate, error rate and latency percentiles first, with resource metrics below for investigation.
Contributor Insights
Contributor Insights analyses log events or DynamoDB traffic and ranks the top contributors, such as the IP addresses with the most errors or the partition keys with the most throttled requests. For DynamoDB it is enabled per table and index with one command:
aws dynamodb update-contributor-insights --table-name Orders --contributor-insights-action ENABLEA dashboard for an order service
An effective operational dashboard is organised so that each row answers a specific question. The following table describes the widgets in each row and the question they answer.
| Row | Widgets | Question answered |
|---|---|---|
| 1 | Request count, 5XX error rate and p99 latency from Application Signals | Are users affected? |
| 2 | Lambda duration, throttles and concurrent executions | Is compute the bottleneck? |
| 3 | DynamoDB throttled requests and Contributor Insights top keys | Is the database the bottleneck? |
| 4 | Logs Insights query of errors by type in 5-minute bins | What is failing? |
| 5 | Alarm status widget | What is already alerting? |
The dashboard is defined in the same CloudFormation stack as the service, so every environment gets an identical view. During an incident, the rows are read top to bottom: from user impact to the component responsible and then to the specific error.
Which CloudWatch feature shows the clients or keys that contribute most to traffic or errors?
Show answer
Contributor Insights. It analyses log events and shows the top contributors, such as the IP addresses or API keys with the most errors.
Exam Tips
Remember for the exam
- To find the hottest DynamoDB keys, use Contributor Insights.
- To view metrics from many accounts on one dashboard, use cross-account observability.
- For CPU, memory and network metrics of individual functions, enable Lambda Insights.
- To find when a problem started, query errors in time buckets with Logs Insights
stats ... by bin(5m).