我已经构建了CloudWatch仪表板,并且希望将其显示在壁挂式屏幕上。我面临的问题是访问:我正在使用具有有限权限的IAM用户连接到仪表板,并且该用户已断开连接after 12 hours。
但是,我想无限期显示仪表板,并且我不想每天都必须手动登录。
是否有更好的方法来发布AWS CloudWatch仪表板?有没有办法让会话持续更长的时间?
您可以使用GetMetricWidgetImage API或get-metric-widget-image command来实现。
[C0示例命令行:
get-metric-widget-image
为了获取metric-widget源,最简单的方法是转到cloudwatch仪表板,选择要编辑的小部件,然后选择“源”选项卡。您可以在此处复制源代码并在上面的命令行中使用它。
还有一个有关如何使用命令的线程: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