Lesson 5 of 5 CloudWatch Metrics, Alarms and Dashboards

Building CloudWatch Dashboards and Amazon Quick Sight Visualisations

Dashboards make the state of systems visible at a glance during operations and incidents, while business intelligence visualisations reveal trends in large datasets such as logs and costs. This lesson explains CloudWatch dashboards and their widgets, cross-account and cross-Region dashboards, sharing, and Amazon Quick Sight for visualising operational data stored in S3 and queried with Athena, and how to choose between them.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe CloudWatch dashboard widgets, automatic dashboards and dashboard variables.
  • Explain how cross-account and cross-Region dashboards are built and how dashboards are shared.
  • Explain how dashboards are defined as code and kept generic with Metrics Insights queries and search expressions.
  • Describe how Amazon Quick Sight visualises operational data from Athena and other sources.
  • Choose between CloudWatch dashboards and Quick Sight for a monitoring or reporting requirement.

CloudWatch Dashboards

A CloudWatch dashboard is a customisable page of widgets: line, stacked area and number widgets for metrics, gauges, bar and pie charts, alarm status widgets that show many alarms at once, Logs Insights query results, text widgets for runbook links, and custom widgets backed by Lambda functions that can display any data. Dashboards refresh automatically and are defined in JSON, so they can be created by CloudFormation or the CDK as part of the application's IaC and kept in version control.

CloudWatch also provides automatic dashboards for AWS services and resource groups, and curated views such as Container Insights, Lambda Insights and Application Signals. Dashboard variables let one dashboard switch between instances, functions or environments with a drop-down, avoiding duplicated dashboards.

Cross-Account, Cross-Region and Sharing

A single dashboard can show metrics from several Regions, and, with cross-account observability or cross-account CloudWatch sharing, from several accounts. A central operations dashboard can therefore show every Region and account that runs a service. Dashboards can be shared with people who do not have AWS accounts, publicly, with specific email addresses through Amazon Cognito authentication, or through single sign-on, which is useful for wall displays and stakeholders.

Good operational dashboards are organised around user experience first: request rate, error rate and latency for each critical journey, then dependencies and resources. Alarm status widgets at the top show at a glance whether anything is wrong.

Dashboards as Code

A dashboard body is a JSON document listing widgets with their position, size and properties. Because the body is plain JSON, a dashboard can be created with put-dashboard, with the AWS::CloudWatch::Dashboard CloudFormation resource or with CDK constructs, and deployed by the same pipeline as the application, so every environment and Region receives an identical dashboard that changes when the application changes. The example below defines an alarm status widget and a metric graph of 5xx errors.

aws cloudwatch put-dashboard --dashboard-name checkout-prod --dashboard-body '{
  "widgets": [
    {"type": "alarm", "x": 0, "y": 0, "width": 24, "height": 3,
     "properties": {"title": "Checkout alarms",
       "alarms": ["arn:aws:cloudwatch:eu-west-1:111122223333:alarm:checkout-composite"]}},
    {"type": "metric", "x": 0, "y": 3, "width": 12, "height": 6,
     "properties": {"title": "Target 5xx errors", "region": "eu-west-1", "stat": "Sum", "period": 60,
       "metrics": [["AWS/ApplicationELB", "HTTPCode_Target_5XX_Count", "LoadBalancer", "app/checkout/50dc6c495c0c9188"]]}}
  ]
}'

Hard-coding resource identifiers, such as the load balancer name above, ties a dashboard to one environment. Two techniques keep dashboards generic. In IaC, the identifiers are references to the resources in the same stack, so each stack's dashboard points at its own resources. In the dashboard itself, a Metrics Insights query widget selects metrics with a SQL-like query, such as SELECT AVG(CPUUtilization) FROM SCHEMA("AWS/EC2", InstanceId) GROUP BY InstanceId ORDER BY AVG() DESC LIMIT 10, which always shows the ten busiest instances, including instances launched after the dashboard was created. Search expressions such as SEARCH('{AWS/Lambda,FunctionName} MetricName="Errors"', 'Sum', 300) similarly match every function that exists when the dashboard is viewed.

Amazon Quick Sight

Amazon Quick Sight, part of Amazon Quick, is a business intelligence service for interactive dashboards over large datasets. It connects to data sources such as Amazon Athena, Amazon S3, Amazon Redshift, Amazon RDS and Amazon OpenSearch Service, can import data into its in-memory engine, SPICE, for fast queries, and supports scheduled refreshes, row-level security, embedded dashboards and natural language questions.

For DevOps work, Quick Sight typically visualises operational data that has been centralised in S3 and made queryable with Athena: CloudTrail logs for API activity trends, ALB and VPC flow logs for traffic analysis, Systems Manager inventory from a Resource Data Sync, AWS Config snapshots, metric stream data, deployment history and cost and usage reports. These are analytical views over weeks or months, not real-time operational monitoring.

Choosing a Visualisation Tool

The two tools serve different needs, compared below. Amazon Managed Grafana is a third option for teams that standardise on Grafana dashboards across many data sources, including CloudWatch, Amazon Managed Service for Prometheus and X-Ray.

CloudWatch dashboards
DataCloudWatch metrics, alarms, logs queries
FreshnessNear real time
StrengthOperational monitoring and incident response
AudienceEngineers and operators
Choose when Watching live system health.
Amazon Quick Sight
DataDatasets from Athena, S3, databases and more
FreshnessScheduled or on-query refresh
StrengthTrend analysis, reporting and business views
AudienceManagers, auditors, analysts
Choose when Analysing historical operational data at scale.
Sort into groups

Choose the visualisation tool

Exam skills 4.2.1

Choose the tool for each monitoring or reporting view.

Log in to try this activity Interactive activities are free with an account.
Worked example

Two Views of the Same Platform

An operations team needs a live view of a platform deployed in 12 accounts and 3 Regions, and leadership wants a monthly report showing deployment frequency, failed deployments and API error trends by team.

  1. Live view

    Create a CloudWatch dashboard in the monitoring account using cross-account observability, with alarm status widgets, request, error and latency graphs per Region, and a variable to select the service; define it in CloudFormation.

  2. Data for reporting

    Send CodePipeline execution events through EventBridge and Firehose to S3, and keep ALB logs and metric stream data in S3.

  3. Report

    Create Athena tables and a Quick Sight dashboard with SPICE refreshed daily, showing deployment frequency, change failure rate and error trends per team.

Check yourself

A team wants a wall display showing current alarm states for all production services, visible to staff who do not have AWS accounts. What should it use?

Show answer

A CloudWatch dashboard with alarm status widgets, shared with the staff through dashboard sharing (for example single sign-on or email-based sharing).

Exam Tips

Remember for the exam

  • CloudWatch dashboards show metrics, alarms and Logs Insights results in near real time, across accounts and Regions; define them in IaC and use variables to avoid duplication.
  • Dashboards can be shared with users without AWS accounts.
  • Dashboard bodies are JSON (put-dashboard, AWS::CloudWatch::Dashboard); Metrics Insights queries and SEARCH expressions include new resources automatically.
  • Amazon Quick Sight visualises historical operational data queried through Athena from S3 (CloudTrail, ALB logs, inventory, metric streams).
  • Choose CloudWatch for live operations and Quick Sight for trend analysis and reporting.