8

I've built a CloudWatch dashboard, and I'd like to display it on a wall-mounted screen. The problem I'm facing is access: I'm using an IAM user with limited privileges to connect to the dashboard, and the user gets disconnected after 12 hours.

However, I'd like to show the dashboard indefinitely, and I don't want to have to manually login every day.

Is there a better way to publish an AWS CloudWatch dashboard? Is there a way for sessions to last longer?

FrontierPsycho
  • 743
  • 7
  • 25

1 Answers1

0

You could use the GetMetricWidgetImage API or get-metric-widget-image command to achieve that.

An example get-metric-widget-image command line:

aws cloudwatch get-metric-widget-image --metric-widget '
{
    "metrics": [
        [ { "expression": "AVG(METRICS())", "label": "Average Access Speed", "id": "e1", "region": "eu-central-1" } ],
        [ "...", "www.xyz.ee", { "label": "[avg: ${AVG}] www.xyz.ee", "id": "m2", "visible": false } ],
        [ "...", "www.abc.com", { "label": "[avg: ${AVG}] www.abc.com", "id": "m3", "visible": false } ],
    ],
    "view": "timeSeries",
    "stacked": false,
    "region": "eu-central-1",
    "title": "Response Time",
    "period": 300,
    "stat": "Average"
}
' | jq -r .MetricWidgetImage | base64 -d | display

In order to get the metric-widget source, it is the easiest to go the cloudwatch dashboard, select the widget for editing, and select the "Source" tab. There you can copy the source code and use it in the above command line.

There is an also a thread about how to use the command: How to use aws cloudwatch get-metric-widget-image?

Miao ZhiCheng
  • 617
  • 7
  • 9