Hourly CloudWatch metric snapshots into Google Sheets

By General Input

Roll a fixed list of CloudWatch metrics into a Google Sheets tab every hour so any dashboard tool can chart infrastructure next to business data.

Integrations

  • Amazon CloudWatch
  • Google Sheets

Type

Deterministic Code

Categories

  • Engineering
  • Operations

Every hour on a cron schedule, snapshot a fixed list of Amazon CloudWatch metrics into a Google Sheets tab so I can build BI dashboards on top of live infrastructure data without paying for a dedicated observability platform.

Treat the metric list as configuration on the workflow. Each entry has a namespace (e.g. AWS/ApplicationELB, AWS/EC2, AWS/Lambda), a metric name (e.g. HTTPCode_Target_5XX_Count, TargetResponseTime, RequestCount, CPUUtilization), a statistic (Average, Sum, p95, and so on), a unit hint, and an optional set of dimensions (LoadBalancer, InstanceId, FunctionName, and the like). Start with error rate, p95 latency, request count, and CPU utilization as sensible defaults, and make it easy for me to add or remove metrics later without changing the code.

For each configured metric, call Amazon CloudWatch Get Metric Data with a start time of one hour ago, an end time of now, and a period of 60 seconds so I get one data point per minute. Batch the metric queries into a single Get Metric Data call where possible to stay well under the CloudWatch throttling quota. Preserve the exact timestamp CloudWatch returns for each data point (ISO 8601 UTC) rather than the workflow run time.

Then call Google Sheets Append Values on the target spreadsheet and tab, adding one row per metric per timestamp. The columns, in order, are: run_at (workflow run time, ISO 8601 UTC), timestamp (the CloudWatch data point time), metric_name, namespace, dimensions (a stable serialized string like key1=value1;key2=value2, sorted by key so joins work), statistic, value, and unit. Use valueInputOption=RAW so CloudWatch's numeric values and ISO timestamps land unmodified and analysts can parse them downstream.

This is a pure deterministic ETL: no AI judgement, no summarisation, no filtering beyond what the configured metric list defines. The metric list, columns, and cadence are fixed, so the workflow should be code and every step should be a documented operation (CloudWatch Get Metric Data de69d4c7-3a3f-4390-9d41-c7793fab79a3, Google Sheets Append Values b8bb536a-33b9-455a-a00b-a652450a6431).

Handle the obvious edge cases: if CloudWatch returns no data points for a metric in the window (common for low-traffic services), skip it silently rather than writing an empty row. If Get Metric Data returns a NextToken, follow the pagination until the full hour is retrieved. Retry Google Sheets 429s and 503s with exponential backoff, capped at a few attempts, so a transient rate-limit does not lose an hour of data.

The sheet becomes the canonical time series that a Looker Studio report, a Sheets chart, or a downstream analyst can join against business data such as deploys, marketing pushes, and feature launches. Keep the column names stable across runs so dashboards built on top do not break.

Related prompts

Explore more prompts
Call overdue Xero customers with an AI collections agentLocal listing health board for every location you manageLet support send one-off Loops emails without an engineerStop cold emails to anyone with a live deal in PipedriveiMessage campaign console with pre-flight checks and delivery boardLinkedIn Ads budget pacing dashboard for every client accountFront desk appointment confirmation board for the next 3 daysGive your team Looker numbers without buying more seatsBuild audience segments from product usage and push to LoopsTurn the people who engage with your posts into Pipedrive leads