Dashboard
Source:
src/AWS/CloudWatch/Dashboard.ts
An Amazon CloudWatch dashboard. The DashboardBody is a structured,
typed document (metric, text, alarm-status, and log widgets) that the
provider serializes to the JSON string CloudWatch expects.
Creating Dashboards
Section titled “Creating Dashboards”Basic Dashboard
const dashboard = yield* Dashboard("OpsDashboard", { DashboardBody: { widgets: [], },});Dashboard with Metric and Text Widgets
const dashboard = yield* Dashboard("PaymentsDashboard", { DashboardBody: { widgets: [ { type: "text", x: 0, y: 0, width: 6, height: 3, properties: { markdown: "# Payments service" }, }, { type: "metric", x: 0, y: 3, width: 12, height: 6, properties: { title: "Payments processed", metrics: [["MyApp/Payments", "PaymentProcessed"]], stat: "Sum", period: 60, view: "timeSeries", }, }, ], },});Reading Dashboards at Runtime
Section titled “Reading Dashboards at Runtime”// init — bind the dashboard to the function (see GetDashboard)const getDashboard = yield* AWS.CloudWatch.GetDashboard(dashboard);
// runtimeconst result = yield* getDashboard();const body = JSON.parse(result.DashboardBody ?? "{}");