Skip to content

Build a Cloudwatch Dashboard from Cloudwatch metrics. This includes SQL expressions as Cloudwatch metrics.

License

Notifications You must be signed in to change notification settings

hseera/cloudwatch-dashboard-builder

Repository files navigation

CloudWatch Dashboard Builder Language Python Apache License GitHub Last Commits GitHub Size

The CloudWatch Dashboard Builder is a useful and convenient tool for individuals such as Site Reliability Engineers (SREs), Performance Engineers, and DevOps professionals who work with AWS services. It enables the generation of the CloudWatch dashboard template from various AWS Namespaces. The metric query for different AWS namespaces can be in the SQL expression form too.

Cloudwatch-dashboard-builder

Table of contents

I have been using the AWS CloudWatch service for close to 10 years for the purpose of monitoring and troubleshooting the performance of applications hosted on AWS. Throughout this period, I have devised various CloudWatch metric queries to facilitate the rapid creation of CloudWatch dashboards for various AWS services.

Initially, I would document commonly used metrics in a notepad, and refer to them as necessary when creating CloudWatch dashboards for new projects, clients, or applications. On occasions, I would not have access to CloudWatch, necessitating that I request a colleague to create a widget or dashboard. Prior to making such requests, it was necessary for me to convert the query into JSON format. Due to these factors and introduction of SQL expression for metrics, I developed a tool for constructing CloudWatch dashboards to improve my productivityby reducing the amount of time spent on repetitive tasks.

The CloudWatch Dashboard Builder grants the capability to generate a time series dashboard template from a selection of predefined metric queries that are included with the tool, or custom ones. Additionally, the dashboard can be created directly from the tool, or the JSON can be copied and the dashboard created through the console or CLI. This is a valuable tool for those who work in the realm of observability and utilize AWS services.

  • Customizable Namespace template
  • Pre-build metric query templates for different AWS Namespaces
  • Create CloudWatch dashboard directly from the tool
  • List existing CloudWatch dashboards
  • Dashboard template creation with a single click
  • Capability to easily pick and choose AWS namespace metrics
  • Automatically build widget layout (N x 2 widget layout)
  • Time-series metric widgets only
  • You must have an Amazon Web Services (AWS) account.
  • The code was written for:
    • Python 3
    • AWS SDK for Python (Boto3)
  • Install the AWS SDK for Python (Boto3).
  • Install the latest Boto 3 release via pip:
    pip install boto3
    
  • Install the latest PySimpleGUi release via pip:
    pip install PySimpleGUI
    
  • Configure your AWS access keys.

    Important: For security, it is strongly recommend that you use IAM users instead of the root account for AWS access.

    When you initialize a new service client without supplying any arguments, the AWS SDK for Python attempts to find AWS credentials by using the default credential provider chain.

    Setting your credentials for use by the AWS SDK for Python can be done in a number of ways, but here are the recommended approaches:

    • The default credential profiles file. Set credentials in the AWS credentials profile file on your local system, located at:

      • ~/.aws/credentials on Linux, macOS, or Unix.
      • C:\Users\USERNAME\.aws\credentials on Windows.

      This file should contain lines in the following format:

        [default]
        aws_access_key_id = <YOUR_ACCESS_KEY_ID>
        aws_secret_access_key = <YOUR_SECRET_ACCESS_KEY>
      

      Replace the values of <YOUR_ACCESS_KEY_ID> and <YOUR_SECRET_ACCESS_KEY> by your AWS credentials.

      image

      Make sure you also set a default region. Set region in the AWS config file on your local system, located at:

      • ~/.aws/config on Linux, macOS, or Unix.
      • C:\Users\USERNAME\.aws\config on Windows.

      This file should contain lines in the following format:

        [default]
        region = <YOUR_DEFAULT_REGION>
      

      Replace the value of <YOUR_DEFAULT_REGION> with your default AWS region. image

    • Credential and region information in the tool Set AWS credentials in the tool with default region. image

  • Run the code. For windows, the github repo already has an executable file that can be downloaded and executed. Otherwise run the application as follows:

    python cloudwatch-dashboard-builder.py
    

    On successful execution of the code, you will see the configuation screen. image

There are a couple of caveats that need to be taken into account.

  • Currently there is only Windows executable shared on github.
  • The present version produces only a time series dashboard.
  • Double quotes in the namespace template queries need to be escaped.
  • Capability to select other types of graphs
  • Capability to add Log Insights metrics
  • Ability to build sql query expression within the tool
  • Capability to save dashboard template for future use
  • Ability to decide on the widget layout
  • How to use CloudWatch Dashboard Builder blog post.

Your contributions are always welcome!

The CloudWatch Dashboard Builder is an open-source and free software released under the APACHE (Apache License 2.0).

About

Build a Cloudwatch Dashboard from Cloudwatch metrics. This includes SQL expressions as Cloudwatch metrics.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages