Skip to content

Instantly share code, notes, and snippets.

@norbinsh
Last active May 26, 2019 21:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save norbinsh/c994e3cfc90e8a977aa11fa5fa12a355 to your computer and use it in GitHub Desktop.
Save norbinsh/c994e3cfc90e8a977aa11fa5fa12a355 to your computer and use it in GitHub Desktop.
def build_widget(name: str, region:str) -> dict:
return {
"type": "metric",
"width": 12,
"height": 9,
"properties": {
"metrics": [
[ "DX", "WaitingInQueue", "CustomerName", f"{name}", { "stat": "Sum" } ]
],
"view": "timeSeries",
"stacked": False,
"region": f"{region}",
"title": f"WaitingInQueue - {name}",
"period": 300
}
}
DashboardBodyReady = {
"widgets": [build_widget(name[0], region) for region in metrics_by_region for name in metrics_by_region[region]]
}
client = boto3.client('cloudwatch', region_name='eu-west-1')
client.put_dashboard(DashboardName='DX', DashboardBody=json.dumps(DashboardBodyReady))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment