BT

InfoQ Homepage News Amazon CloudWatch Dashboards Gains API and CloudFormation Support

Amazon CloudWatch Dashboards Gains API and CloudFormation Support

Bookmarks

Amazon Web Services (AWS) recently added programmatic creation and manipulation of CloudWatch dashboards and widgets to support use cases such as dynamic resource lifecycle tracking and consistent cross-account dashboard maintenance.

Amazon CloudWatch Dashboards is an AWS account level Amazon CloudWatch feature (previous coverage) that provides "customizable home pages" with views of metrics, alarms and runbooks in order to monitor AWS resources across different regions. Dashboard widgets can either display a set of CloudWatch Metrics as single values, line charts, or stacked area charts, or display text specified in GitHub Flavored Markdown to share operational playbooks, including links to other dashboards or external resources.

Other than usual, AWS did not publish the API backing the interactive dashboard creation via the console right away, thereby preventing reuse and dynamic provisioning of dashboards in sync with the monitored resources via infrastructure as code. This gap has now been closed with the availability of API, CLI and CloudFormation support for imperative and declarative creation and manipulation of dashboards. Dashboards are represented as a JSON structure that is also accessible from the AWS console to provide "a starting point for your own applications" so that users can easily export manually created dashboards for later automated usage.

Amazon CloudWatch dashboard menu

The simple dashboard body structure and syntax allows to position and configure the widgets based on mostly self-explanatory properties. A dashboard is composed of a 24 cells wide grid that grows as tall as necessary, and widgets span an integral number of grid cells. As a shortcut for the possibly repetitive metrics array, values from the preceding metric can be reused by specifying only "." in subsequent metrics:

{
  "widgets": [
    {
      "type": "metric",
      "x": 0, "y": 0, "width": 6, "height": 6,
      "properties": {
        "view": "timeSeries",
        "stacked": false,
        "metrics": [
          [
            "AWS/EC2", "NetworkIn", "AutoScalingGroupName", "ECS-ClusterASG-ZGR8VLF5QBLQ"
          ],
          [
            ".", "NetworkOut", ".", "."
          ]
        ],
        "region": "ap-southeast-2"
      }
    }
  ]
}

A more comprehensive example is included with the cloudwatch-dashboards-cloudformation-sample, which also demonstrates how to use the AWS::CloudWatch::Dashboard resource to provision dashboards with AWS CloudFormation, AWS' own infrastructure as code management offering. The cross-platform open source alternative Terraform provides an aws_cloudwatch_dashboard resource as well.

In related news, Amazon CloudWatch also added horizontal annotations for graphs that "can serve as quick visual checks of metrics crossing pre-defined values, such as SLA limits, or provide contextual information for interpreting metric values". Lines can be manually or programmatically added at key values on the Y-axis, and areas between lines can optionally be shaded. These user provided annotations complement the ability to visualize CloudWatch alarms on dashboards, which AWS launched earlier this year.

The Amazon CloudWatch documentation features a user guide, including a using dashboards section, the AWS CLI reference, and the API reference. Support is provided via the Amazon CloudWatch forum. Users can create three dashboards with up to fifty metrics per dashboard at no charge, additional dashboards and API calls beyond the first million are subject to usage based pricing.

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT

Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
Country/Zone:
State/Province/Region:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.