Based on aws-cloudwatch-annotations.
Annotate Cloudwatch dashboards with vertical annotations automatically by sending JSON to the API. Make sure to update "cloudwatch.js" with your region of your dashboard.
If you're running this on an EC2 instance add the following permissions to the instance role. Adapt it with the correct AWS account ID and dashboard name(s).
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"cloudwatch:PutDashboard",
"cloudwatch:GetDashboard"
],
"Resource": [
"arn:aws:cloudwatch::123456789123:dashboard/annotations"
]
}
]
}
Use the following format for your JSON:
{
"dashboardName":"${dasboardName}",
"type":"${verticalOrHorizontal}",
"widgetTitle":"${titleOfWidgetToUpdate}",
"time":"${timeOrValue}",
"eventTitle":"${titleOfAnnotation}"
}