

# Using widgets on CloudWatch dashboards
Using widgets on dashboards

You can use the following types of widgets on CloudWatch dashboards:
+ **Graph widget** – You can add graphs that contain one or more metrics to your CloudWatch dashboard. The types of graphs that you can add to your dashboard include ***Line***, ***Stacked area***, ***Number***, ***Gauge***, ***Bar***, and ***Pie***. You can remove graphs from your dashboard when you don't need them anymore. 
+ **Manual metrics widget** – If a metric hasn't published data in the past 14 days, you can't find it when searching for metrics to add to a graph on a CloudWatch dashboard. You can add any metric manually to an existing graph.
+ **Metrics explorer widget** – Metrics explorer widgets include graphs of multiple resources that have the same tag, or share the same resource property such as an instance type. These widgets stay up to date, as resources that match are created or deleted. Adding metrics explorer widgets to your dashboard helps you to troubleshoot your environment more efficiently.

  For example, you can monitor your fleet of EC2 instances by assigning tags that represent their environments, such as production or test. You can then use these tags to filter and aggregate the operational metrics, such as `CPUUtilization`, to understand the health and performance of the EC2 instances that are associated with each tag.
+ **Line widget** – With the line widget, you can compare metrics over periods of time. You also can use the widget's mini-map zoom feature to inspect sections of line graphs without changing between zoomed-in and zoomed-out views. The procedures in this section describe how to add and remove a line widget on a CloudWatch dashboard. For information about using the widget's mini-map zoom feature with line graphs, see [Zooming in on a line or stacked area graph](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/zoom-graph.html).
+ **Number widget** – With the number widget, you can look at the latest metric values and trends as soon as they appear. Because the number widget includes the sparkline feature, you can visualize the top and bottom halves of metric trends in a single graph. The procedures in this section describe how to add and remove a number widget from a CloudWatch dashboard. 
+ **Gauge widget** – With the gauge widget, you can visualize metric values that go between ranges. For example, you can use the gauge widget to graph percentages and CPU utilization, so that you can observe and diagnose any performance issues that occur. The procedures in this section describe how to add and remove a gauge widget from a CloudWatch dashboard. 
+ **Text widget** – A text widget contains a block of text in [Markdown](https://docs.aws.amazon.com/general/latest/gr/aws-markdown.html) format. You can add, edit, or remove text widgets from your CloudWatch dashboard.
+ **Alarm widget** – To add an alarm widget to a dashboard, choose one of the following options:
  + Add a single alarm in a widget, which displays the graph of the alarm's metric and also displays the alarm status.
  + Add an *alarm status widget*, which displays the status of multiple alarms in a grid. Only the alarm names and current status are displayed, Graphs are not displayed. You can include up to 100 alarms in one alarm status widget.
+ **Table widget** – With the data table widget, you can see the raw datapoints of your metric and a quick summary of that raw data. Because the data table widget is not a chart to abstract the actual data away from you, it is easier to understand the datapoints being presented. The procedures in this section describe how to add and remove a data table widget from a CloudWatch dashboard. The following image shows an example of a table widget with columns for the Minimum, Maximum, Sum, and Average statistics for a set of CloudWatch metrics.
+ **Linked graphs** – You can link the graphs on your dashboard together, so that when you zoom in or zoom out on one graph, the other graphs zoom in or zoom out at the same time. You can unlink graphs to limit zoom to one graph.

**Topics**
+ [Adding a graph widget](add_graph_dashboard.md)
+ [Removing a graph widget](remove_graph_dashboard.md)
+ [Graph metrics manually on a dashboard](add_old_metrics_to_graph.md)
+ [Editing a graph](edit_graph_dashboard.md)
+ [Renaming a graph](rename_graph_dashboard.md)
+ [Moving a graph](move_graph_dashboard.md)
+ [Changing the size of graphs](#resize_graph_dashboard)
+ [Changing the size of a graph temporarily](#resize_graph_temp_dashboard)
+ [Add a metrics explorer widget](add_metrics_explorer_dashboard.md)
+ [Adding a line graph widget](add_line_dashboard.md)
+ [Removing a line graph](remove_line_dashboard.md)
+ [Adding a number widget](add_number_dashboard.md)
+ [Removing a number widget](remove_number_dashboard.md)
+ [Adding a gauge widget](add_gauge_dashboard.md)
+ [Removing a gauge widget](remove_gauge_dashboard.md)
+ [Using a custom widget](add_custom_widget_dashboard.md)
+ [Adding a text widget](add_text_dashboard.md)
+ [Editing a text widget](edit_text_dashboard.md)
+ [Removing a text widget](remove_text_dashboard.md)
+ [Adding an alarm](add_alarm_dashboard.md)
+ [Adding an alarm status widget](add_alarm_widget_dashboard.md)
+ [Removing an alert widget](remove_alarm_dashboard.md)
+ [Using a data table widget](add_remove_table_dashboard.md)
+ [Linking graphs](link_graphs_dashboard.md)
+ [Unlinking graphs](unlink_graphs_dashboard.md)

# Adding a graph widget to a CloudWatch dashboard
Adding a graph widget

The procedures in this section describe how to add and remove graphs from your dashboard. For information about how to edit a graph on your dashboard, see [ Edit a graph on a CloudWatch dashboard](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/edit_graph_dashboard.html). 

**To add a graph to a dashboard**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1.  In the navigation pane, choose **Dashboards**, and then choose a dashboard. 

1.  Choose the **\$1** symbol, and then choose the type of graph that you want to add to your dashboard, then choose **Next**. 

   1.  If you select ***Line***, ***Stacked area***, ***Bar***, or ***Pie***, choose **Metrics**. 

1.  In the **Browse** tab, search or browse for the metrics to graph, and select the ones that you want. 

1.  (Optional) To change your graph's time range, select one of the predefined time ranges in the upper part of the screen. The time ranges span from 1 hour to 1 week (***1h***, ***3h***, ***12h***, ***1d***, ***3d***, or ***1w***). 

    To set your own time range, choose **Custom**. 

   1. (Optional) To have this widget keep using this time range that you select, even if the time range for the rest of the dashboard is later changed, choose **Persist time range**.

1.  (Optional) To change your graph's widget type, use the dropdown that's next to the predefined time ranges. 

1.  (Optional) In **Graphed metrics**, you can add a dynamic label to your metric and change your metric's label, label color, statistic, and period. You also can determine the position of labels on the Y-axis from left to right. 

   1.  To add a dynamic label, choose **Graphed metrics**, and then choose **Add dynamic labels**. Dynamic labels display a statistic about your metric in the graph legend. Dynamic labels update automatically when your dashboard or graph refreshes. By default, the dynamic values that you add to labels appear at the beginning of your labels. For more information, see [Use dynamic labels](graph-dynamic-labels.md). 

   1.  To change the color of a metric, choose the color square that's next to the metric. 

   1.  To change the statistic, select the dropdown under ***Statistic***, and then choose a new value. For more information, see [Statistics](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#Statistic). 

   1.  To change the period, select the dropdown under the ***Period*** column, and then choose a new value. 

1. If you are creating a gauge widget, you must choose the **Options** tab and specify the **Min** and **Max** values to use for the two ends of the gauge.

1.  (Optional) To customize the Y-axis, choose **Options**. You can add a custom label under ***Left Y-axis*** in the label field. If your graph displays values on the right side of the Y-axis, you can customize that label, too. You also can set minimum and maximum limits on your Y-axis values, so that your graph only displays the value ranges that you specify. 

1.  (Optional) To add or edit horizontal annotations to line or stacked area graphs, or to add thresholds to gauge widgets, choose **Options**: 

   1.  To add a horizontal annotation or threshold, choose **Add horizontal annotation** or **Add threshold**. 

   1.  For ***Label***, enter a label for the annotation then choose the check mark icon. 

   1.  For ***Value***, choose the pen and paper icon that's next to the current value, and enter your new value. After you enter your value, choose the check mark icon.

   1.  For ***Fill***, select the dropdown and specify how your annotation will use shading. You can choose ***None***, ***Above***, ***Between***, or ***Below***. To change the fill color, choose the color square that's next to the annotation. 

   1.  For ***Axis***, specify whether your annotation appears on the left or right side of the Y-axis. 

   1.  To hide an annotation, clear the check box that's next to the annotation you want to hide. 

   1.  To delete an annotation, choose **X** under ***Actions***. 
**Note**  
 You can repeat these steps to add multiple horizontal annotations or thresholds to the same graph or gauge. 

1.  (Optional) To add or edit vertical annotations, choose **Options**: 

   1.  To add a vertical annotation, choose **Add vertical annotation**. 

   1.  For ***Label***, choose the pen and paper icon that's next to the current annotation, and enter your new annotation. If you want to show only the date and time, leave the label field blank. 

   1.  For ***Date***, choose the current date and time, and enter the new date and time. 

   1.  For ***Fill***, select the dropdown, and specify how your annotation will use shading. You can choose ***None***, ***Above***, ***Between***, or ***Below***. To change the fill color, select the color square that's next to the annotation.

   1.  To hide an annotation, clear the check box next to the annotation that you want to hide. 

   1.  To delete an annotation, choose **X** under ***Actions***. 
**Note**  
 You can repeat these steps to add multiple vertical annotations to the same graph. 

1. Choose **Create widget**.

1. Choose **Save dashboard**.

# Removing a graph widget from a CloudWatch dashboard
Removing a graph widget

**To remove a graph from a dashboard**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1.  In the navigation pane, choose **Dashboards**, and then choose a dashboard. 

1.  In the upper-right corner of the graph that you want to remove, choose **Widget actions**, and then choose **Delete**. 

1.  Choose **Save dashboard**. 

# Graph metrics manually on a CloudWatch dashboard
Graph metrics manually on a dashboard

**To add a metric that you can't find in search to a graph**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1. In the navigation pane, choose **Dashboards**, and then choose a dashboard.

1. The dashboard must already contain a graph where you want to add the metric. If it doesn't, create the graph and add any metric to it. For more information, see [Adding a graph widget to a CloudWatch dashboard](add_graph_dashboard.md).

1. Choose **Actions**, **View/edit source**.

   A JSON block appears. The block specifies the widgets on the dashboard and their contents. The following is an example of one part of this block, which defines one graph.

   ```
   {
     "type": "metric",
     "x": 0,
     "y": 0,
     "width": 6,
     "height": 3,
     "properties": {
       "view": "singleValue",
       "metrics": [
         [
           "AWS/EBS",
           "VolumeReadOps",
           "VolumeId",
           "vol-1234567890abcdef0"
         ]
       ],
       "region": "us-west-1"
     }
   },
   ```

   In this example, the following section defines the metric shown on this graph.

   ```
   [ "AWS/EBS", "VolumeReadOps", "VolumeId", "vol-1234567890abcdef0" ]
   ```

1. Add a comma after the end bracket if there isn't already one and then add a similar bracketed section after the comma. In this new section, specify the namespace, metric name, and any necessary dimensions of the metric that you're adding to the graph. The following is an example.

   ```
   [ "AWS/EBS", "VolumeReadOps", "VolumeId", "vol-1234567890abcdef0" ],
   [ "MyNamespace", "MyMetricName", "DimensionName", "DimensionValue" ]
   ```

   For more information about the formatting of metrics in JSON, see [ Properties of a Metric Widget Object](https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/CloudWatch-Dashboard-Body-Structure.html#CloudWatch-Dashboard-Properties-Metric-Widget-Object) in the Amazon CloudWatch API Reference.

1. Choose **Update**.

# Editing a graph on a CloudWatch dashboard
Editing a graph

 You can edit the graphs that you add to your CloudWatch dashboard. You can change a graph's title, statistic, or period. You can add, update, and remove metrics from your graphs. If your graph contains more than one metric, you can reduce clutter by hiding metrics that you aren't using. The procedures in this section describe how to edit a graph on your dashboard. For information about creating a graph, see [Add or remove a graph from a CloudWatch dashboard](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/add_remove_graph_dashboard.html). 

------
#### [  New interface  ]

**To edit a graph on a dashboard**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1.  In the navigation pane, choose **Dashboards**, and then choose a dashboard. 

1.  In the upper-right corner of the graph that you want to edit, choose **Widget actions**, and then choose **Edit**. 

1.  To change the graph's title, choose the pen and paper icon that's next to the current title. Enter the new title, and then choose **Apply**. 

1.  (Optional) To change your graph's time range, select one of the predefined time ranges in the upper are of the graph. The time ranges span from 1 hour to 1 week (***1h***, ***3h***, ***12h***, ***1d***, ***3d***, or ***1w***). 

    To set your own time range, choose **Custom**. 

   1. (Optional) To have this widget keep using this time range that you select, even if the time range for the rest of the dashboard is later changed, choose **Persist time range**.

1.  To change your graph's widget type, use dropdown that's next to the predefined time ranges. 

1.  In **Graphed metrics**, you can add a dynamic label to your metric and change your metric's label, label color, statistic, and period. You also can determine the position of labels on the Y-axis from left to right. 

   1.  To add a dynamic label for a metric, choose **Dynamic labels**. Dynamic labels display a statistic about the metric in the graph legend. Dynamic labels update automatically when your dashboard or graph refreshes. By default, the dynamic values that you add to labels appear at the beginning of the labels. For more information, see [Use dynamic labels](graph-dynamic-labels.md). 

   1.  To change the color of a metric, choose the color square that's next to the metric. 

   1.  To change the statistic, choose the statistic value under the ***Statistic*** column, and then choose a new value. For more information, see [Statistics](cloudwatch_concepts.md#Statistic). 

   1.  To change the period, choose the period value under the ***Period*** column, and then choose a new value. 

1.  To add or edit horizontal annotations, choose **Options**: 

   1.  To add a horizontal annotation, choose **Add horizontal annotation**. 

   1.  For **Label**, choose the pen and paper icon next to the current annotation. Then enter your new annotation. After you enter your annotation, choose the check mark icon. 

   1.  For **Value**, choose the pen and paper icon next to the current metric value. Then enter your new metric value. After you enter your value, select the check mark icon. 

   1.  For **Fill**, choose the dropdown under the column, and then specify how your annotation will use shading. You can choose **None**, **Above**, **Between**, or **Below**. If you choose **Between**, another new label and value field appears. 
**Tip**  
 You can change the fill color by choosing the colored square next to the annotation. 

   1.  For **Axis**, specify whether your annotation appears on the left or right side of the Y-axis. 

   1.  To hide an annotation, deselect the check box next to the annotation that you want to hide on the graph. 

   1.  To delete an annotation, choose **X** under the **Actions** column. 
**Note**  
 You can repeat these steps to add multiple horizontal annotations to the same graph. 

1.  To add or edit vertical annotations, choose **Options**: 

   1.  To add a vertical annotation, choose **Add vertical annotation**. 

   1.  For **Label**, choose the pen and paper icon next to the current annotation. Then enter your new annotation. After you enter your annotation, choose the check mark icon. 
**Tip**  
 To show only the date and time, leave the label field blank. 

   1.  For **Date**, choose the current date and time. Then enter the new date and time. 

   1.  For **Fill**, choose the dropdown under the column, and then specify how your annotation will use shading. You can choose **None**, **Above**, **Between**, or **Below**. If you choose **Between**, a new label and value field appears. 
**Tip**  
 You can change the fill color by choosing the color square next to the annotation. 
**Note**  
 You can repeat these steps to add multiple vertical annotations to the same graph. 

   1.  To hide an annotation, deselect the check box next to the annotation that you want to hide on the graph. 

   1.  To delete an annotation, choose **X** under the **Actions** column. 

1.  To customize the Y-axis, choose **Options**. Under ***Left Y-axis***, you can enter a custom label for **Label**. If the graph displays values on the right Y-axis, you can customize that label, too. You also can set minimums and maximums on the Y-axis values, so that the graph displays only the value range that you specify. 

1.  When you finish making changes, choose **Update widget**. 

**To hide or change the position of a graph legend**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1.  In the navigation pane, choose **Dashboards**, and then choose a dashboard. 

1.  In the upper-right corner of the graph that you want to edit, choose **Widget actions**. Choose **Legend** and select **Hidden**, **Bottom**, or **Right**. 

**To temporarily hide metrics for a graph on a dashboard**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1.  In the navigation pane, choose **Dashboards**, and then choose a dashboard. 

1.  Select the color square for the metric that you want to hide in the graph's footer. An ***X*** appears in the color square when you hover over it, and the square turns gray when you choose it. 

1.  To restore the hidden metric, clear the **X** in the gray square. 

------
#### [  Original interface  ]

**To edit a graph on a dashboard**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1.  In the navigation pane, choose **Dashboards**, and then choose a dashboard. 

1.  Hover over the upper-right corner of the graph that you want to edit. Choose **Widget actions**, and then choose **Edit**. 

1.  To change the graph's title, choose the pencil icon that's next to the current title, and then enter the new title. 

1.  To change the graph's time range, choose one of the predefined time ranges in the upper area of the graph. These span from 1 hour to 1 week (***1h***, ***3h***, ***12h***, ***1d***, ***3d***, or ***1w***). 

   1.  To set your own time range, choose **custom**. 

1.  To change your graph's widget type, select the **Graph options** tab. You can choose ***Line***, ***Stacked area***, ***Number***, ***Bar***, or ***Pie***. 
**Tip**  
 You can change your graph's widget type by choosing the dropdown that's next to the predefined time ranges. 

1.  In **Graphed metrics**, you can add a dynamic label to your metric and change your metric's label, label color, statistic, and period. You also can determine the position of labels on the Y-axis from left to right. 

   1.  To add a dynamic label for a metric, choose **Dynamic labels**. Dynamic labels display a statistic about the metric in the graph legend. Dynamic labels update automatically when your dashboard or graph refreshes. By default, the dynamic values that you add to labels appear at the beginning of the labels. For more information, see [Use dynamic labels](graph-dynamic-labels.md). 

   1.  To change the color of a metric, choose the color square that's next to the metric. 

   1.  To change the statistic, choose the statistic value under the ***Statistic*** column, and then choose a new value. For more information, see [Statistics](cloudwatch_concepts.md#Statistic). 

   1.  To change the period, choose the period value under the ***Period*** column, and then choose a new value. 

1.  To add or edit horizontal annotations, choose **Graph options**: 

   1.  To add a horizontal annotation, choose **Add horizontal annotation**. 

   1.  For **Label**, choose the pencil icon next to the current annotation. Then enter your new annotation. After you enter your annotation, choose the check mark icon. 

   1.  For **Value**, choose the pencil icon next to the current metric value. Then enter your new metric value. After you enter your value, select the check mark icon. 

   1.  For **Fill**, choose the dropdown under the column, and then specify how your annotation will use shading. You can choose **None**, **Above**, **Between**, or **Below**. If you choose **Between**, a new label and value field appears. 
**Tip**  
 You can change the fill color by choosing the color square next to the annotation. 

   1.  For **Axis**, specify whether your annotation appears on the left or right side of the Y-axis. 

   1.  To hide an annotation, deselect the check box next to the annotation that you want to hide on the graph. 

   1.  To delete an annotation, choose **X** under the **Actions** column. 
**Note**  
 You can repeat these steps to add multiple horizontal annotations to the same graph. 

1.  To add or edit vertical annotations, choose **Graph options**: 

   1.  To add a vertical annotation, choose **Add vertical annotation**. 

   1.  For **Label**, choose the pencil icon next to the current annotation. Then enter your new annotation. After you enter your annotation, choose the check mark icon. 
**Tip**  
 To show only the date and time, leave the label field blank. 

   1.  For **Date**, choose the pencil icon next to the current date and time. Then enter the new date and time. 

   1.  For **Fill**, choose the dropdown under the column, and then specify how your annotation will use shading. You can choose **None**, **Above**, **Between**, or **Below**. If you choose **Between**, a new label and value field appears. 
**Tip**  
 You can change the fill color by choosing the color square next to the annotation. 
**Note**  
 You can repeat these steps to add multiple vertical annotations to the same graph. 

   1.  To hide an annotation, deselect the check box next to the annotation that you want to hide on the graph. 

   1.  To delete an annotation, choose **X** under the **Actions** column. 

1.  To customize the Y-axis, choose **Graph options**. Under ***Left Y-axis***, you can enter a custom label for **Label**. If the graph displays values on the right Y-axis, you can customize that label, too. You also can set minimums and maximums on the Y-axis values, so that the graph displays only the value range that you specify. 

1.  When you finish making changes, choose **Update widget**. 

**To hide or change the position of a graph legend**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1.  In the navigation pane, choose **Dashboards**, and then choose a dashboard. 

1.  Hover over the upper-right corner of the graph that you want to edit, and choose **Widget actions**. Choose **Legend**, and select **Hidden**, **Bottom**, or **Right**. 

**To temporarily hide metrics for a graph on a dashboard**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1.  In the navigation pane, choose **Dashboards**, and then choose a dashboard. 

1.  Select the color square for the metric that you want to hide in the graph's footer. An ***X*** appears in the color square when you hover over it, and the square turns gray when you choose it. 

1.  To restore the hidden metric, clear the **X** in the gray square. 

------

# Renaming a graph on a CloudWatch dashboard
Renaming a graph

You can change the default name that CloudWatch assigns to a graph on your dashboard.

**To rename a graph on a dashboard**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1. In the navigation pane, choose **Dashboards**, and then choose a dashboard.

1. Hover over the title of the graph and choose **Widget actions** and **Edit**.

1. On the **Edit graph** screen, near the top, choose the title of the graph.

1. For **Title**, enter a new name and choose **Ok** (check mark). In the lower-right corner of the **Edit graph** screen, choose **Update widget**.

# Moving a graph on a CloudWatch dashboard
Moving a graph

**To move a graph on a dashboard**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1. In the navigation pane, choose **Dashboards**, and then choose a dashboard.

1. Do one of the following:
   + Hover over the title of the graph until the selection icon appears. Select and drag the graph to a new location on the dashboard.
   + To move the widget to either the top left or bottom left of the dashboard, choose the vertical ellipsis at the upper right of the widget to open the **Widget actions** menu. Then choose **Move**, and choose where to move the widget to.

1. Choose **Save dashboard**.

## Changing the size of graphs on CloudWatch dashboards
Changing the size of graphs

**To change the size of a graph**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1. In the navigation pane, choose **Dashboards**, and then choose a dashboard.

1. To increase or decrease the size, hover over the graph and drag the lower right corner of the graph. Stop dragging the corner when you have the size that you want.

1. Choose **Save dashboard**.

## Changing the size of a graph temporarily on a CloudWatch dashboard
Changing the size of a graph temporarily

**To enlarge a graph temporarily**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1. In the navigation pane, choose **Dashboards**, and then choose a dashboard.

1. Select the graph. Alternatively, hover over the title of the graph and choose **Widget actions**, **Enlarge**.

# Add a metrics explorer widget to a CloudWatch dashboard
Add a metrics explorer widget

The following steps explain how to add a metrics explorer widget to a dashboard using the console. You can also add it programmatically or by using CloudFormation. For more information, see [ Metrics Explorer Widget Object Definition](https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/CloudWatch-Dashboard-Body-Structure.html#CloudWatch-Dashboard-Properties-Metric-Explorer-Object) and [ AWS::CloudWatch::Dashboard](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudwatch-dashboard.html).

**To add a metrics explorer widget to a dashboard**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1. In the navigation pane, choose **Dashboards**.

1. Choose the name of the dashboard where you want to add the metrics explorer widget.

1. Choose the **\$1** symbol.

1. Choose **Explorer** and then choose **Next**. 
**Note**  
You must be opted in to the new dashboard view to be able to add a Metrics Explorer widget. To opt in, choose **Dashboards** in the navigation pane, then choose **try out the new interface** in the banner at the top of the page.

1. Do one of the following:
   + To use a template, choose **Pre-filled Explorer widget** and then select a template to use.
   + To create a custom visualization, choose **Empty Explorer widget**.

1. Choose **Create**.

   If you used a template, the widget appears on your dashboard with the selected metrics. If you're satisfied with the explorer widget and the dashboard, choose **Save dashboard**.

   If you did not use a template, continue to the following steps.

1. In the new widget under **Explorer**, in the **Metrics** box, choose a single metric or all the available metrics from a service.

   After you choose a metric, you can optionally repeat this step to add more metrics.

1. For each metric selected, CloudWatch displays the statistic that it will use immediately after the metric name. To change this, choose the statistic name and then choose the statistic that you want.

1. Under **From**, choose a tag or a resource property to filter your results.

   After you do this, you can optionally repeat this step to choose more tags or resource properties.

   If you choose multiple values of the same property, such as two EC2 instance types, the explorer displays all the resources that match either chosen property. It's treated as an OR operation.

   If you choose different properties or tags, such as the **Production** tag and the M5 instance type, only the resources that match all of these selections are displayed. This is treated as an AND operation.

1. (Optional) For **Aggregate by**, choose a statistic to use to aggregate the metrics. Then, next to **for**, choose how to aggregate the metric from the list. You can aggregate together all the resources that are currently displayed, or aggregate by a single tag or resource property.

   Depending on how you choose to aggregate, the result may be a single time series or multiple time series. 

1. Under **Split by**, you can choose to split a single graph with multiple time series into multiple graphs. The split can be made by a variety of criteria, which you choose under **Split by**.

1. Under **Graph options**, you can refine the graph by changing the period, the type of graph, the legend placement, and the layout.

1. If you're satisfied with the explorer widget and the dashboard, choose **Save dashboard**.

# Adding a line graph widget to a CloudWatch dashboard
Adding a line graph widget

**To add a line widget to a dashboard**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1.  In the navigation pane, choose **Dashboards**, and then choose a dashboard. 

1.  Choose the **\$1** symbol, and select **Line**. 

1.  Choose **Metrics**. 

1.  Choose **Browse**, and select the metric that you want to graph. 

1.  Choose **Create widget**, and then choose **Save dashboard**. 

# Removing a line graph widget from a CloudWatch dashboard
Removing a line graph

**To remove a line graph widget from a dashboard**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1.  In the navigation pane, choose **Dashboards**, and then choose a dashboard. 

1.  In the upper-right corner of the line widget that you want to remove, choose **Widget actions**, and then choose **Delete**. 

1.  Choose **Save dashboard**. 

# Adding a number widget to a CloudWatch dashboard
Adding a number widget

**Note**  
 Only the new interface supports the sparkline feature. When you create a number widget, the sparkline feature is automatically included. 

**To add a number widget to a dashboard**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1.  In the navigation pane, choose **Dashboards**, and then choose a dashboard. 

1.  Choose the **\$1** symbol, and select **Number**. 

1.  In the **Browse** tab, search or browse for the metric that you want to display. 

1.  (Optional) To change the color of the sparkline feature, choose **Graphed metrics**, and select the color box next to the metric label. A menu appears where you can choose a different color or enter a six-digit hex color code to specify a color. 

1.  (Optional) To turn off the sparkline feature, choose **Options**. Under ***Sparkline***, the check box. 

1.  (Optional) To change your number widget's time range, select one of the predefined time ranges in the upper area of the widget. The time ranges span from 1 hour to 1 week (***1h***, ***3h***, ***12h***, ***1d***, ***3d***, or ***1w***). 

    To set your own time range, choose **Custom**. 

   1. (Optional) To have this widget keep using this time range that you select, even if the time range for the rest of the dashboard is later changed, choose **Persist time range**.

1.  (Optional) To have the number widget display an aggregate (***1h***, ***3h***, ***12h***, ***1d***, ***3d***, or ***1w***). 

    To set your own time range, choose **Custom**. 

   1. (Optional) To have this widget display an average of the metric value over the entire time range, instead of the most recent value, choose **Options**, **Time range value shows the value from the entire time range**.

1.  Choose **Create widget**, and choose **Save dashboard**. 

**Tip**  
 You can turn off the sparkline feature from the number widget on the dashboard screen. In the upper-right corner of the number widget that you want to modify, choose **Widget actions**. Select **Sparkline**, and then choose **Hide sparkline**. 

# Removing a number widget from a CloudWatch dashboard
Removing a number widget

**To remove a number widget from a dashboard**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1.  In the navigation pane, choose **Dashboards**, and then choose the dashboard that contains the number widget that you want to delete. 

1.  In the upper-right corner of the number widget that you want to remove, choose **Widget actions**, and then choose **Delete**. 

1.  Choose **Save dashboard**. 

# Adding a gauge widget to a CloudWatch dashboard
Adding a gauge widget

**Note**  
 Only the new interface in the CloudWatch console supports creation of the gauge widget. You must set a gauge range when you create this widget. 

**To add a gauge widget to a dashboard**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1. In the navigation pane, choose **Dashboards**, and then choose a dashboard. 

1. From the dashboard screen, choose the **\$1** symbol, and then select **Gauge**. 

1.  Choose **Browse**, and then select the metric that you want to graph. 

1.  Choose **Options**. Under ***Gauge range***, set values for **Min** and **Max**. For percentages, such as CPU utilization, we recommend that you set the values for `Min` to `0` and `Max` to `100`. 

1.  (Optional) To change the color of the gauge widget, choose **Graphed metrics** and select the color box next to the metric label. A menu appears where you can choose a different color or enter a six-digit hex color code to specify a color. 

1.  Choose **Create widget**, and choose **Save dashboard**. 

# Removing a gauge widget from a CloudWatch dashboard
Removing a gauge widget

**To remove a gauge widget from a dashboard**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1.  In the navigation pane, choose **Dashboards**, and then choose the dashboard that contains the gauge widget you want to delete. 

1.  In the upper-right corner of the gauge widget that you want to delete, choose **Widget actions**, and choose **Delete**. 

1.  Choose **Save dashboard**. 

# Using a custom widget on a CloudWatch dashboard
Using a custom widget

A *custom widget* is a CloudWatch dashboard widget that can call any AWS Lambda function with custom parameters. It then displays the returned HTML or JSON. Custom widgets are a simple way to build a custom data view on a dashboard. If you can write Lambda code and create HTML, you can create a useful custom widget. Additionally, Amazon provides several prebuilt custom widgets that you can create without any code.

When you create a Lambda function to use as a custom widget, we strongly recommend that you include the prefix **customWidget** in the function name. This helps you know which of your Lambda functions are safe to use when you add custom widgets to your dashboard.

Custom widgets behave like other widgets on your dashboard. They can be refreshed and auto-refreshed, resized, and moved around. They react to the time range of the dashboard.

If you have set up CloudWatch console cross-account functionality, you can add a custom widget created in one account to dashboards in other accounts. For more information, see [Cross-account cross-Region CloudWatch console](Cross-Account-Cross-Region.md).

You can also use custom widgets on your own website by using the CloudWatch dashboard sharing feature. For more information, see [Sharing CloudWatch dashboards](cloudwatch-dashboard-sharing.md).

**Topics**
+ [

# Details about custom widgets in CloudWatch
](add_custom_widget_dashboard_about.md)
+ [

# Security and JavaScript for custom CloudWatch widgets
](add_custom_widget_dashboard_security.md)
+ [

# Interactivity in the custom widget in CloudWatch
](add_custom_widget_dashboard_interactivity.md)
+ [

# Creating a custom widget for a CloudWatch dashboard
](add_custom_widget_dashboard_create.md)
+ [

# Sample custom widgets for a CloudWatch dashboard
](add_custom_widget_samples.md)

# Details about custom widgets in CloudWatch
Details about custom widgets

Custom widgets work as follows:

1. The CloudWatch dashboard calls the Lambda function containing the widget code. It passes in any custom parameters that are defined in the widget.

1. The Lambda function returns a string of HTML, JSON, or Markdown. Markdown is returned as JSON in the following format:

   ```
   {"markdown":"markdown content"}
   ```

1. The dashboard displays the returned HTML or JSON.

If the function returns HTML, most HTML tags are supported. You can use Cascading Style Sheets (CSS) styles and Scalable Vector Graphics (SVG) to build sophisticated views.

The default style of HTML elements such as links and tables follow the styling of CloudWatch dashboards. You can customize this style by using inline styles, using the `<style>` tag. You can also deactivate the default styles by including a single HTML element with the class of `cwdb-no-default-styles`. The following example deactivates default styles: `<div class="cwdb-no-default-styles"></div>`.

Every call by a custom widget to Lambda includes a `widgetContext` element with the following contents, to provide the Lambda function developer with useful context information.

```
{
  "widgetContext": {
    "dashboardName": "Name-of-current-dashboard",
    "widgetId": "widget-16",
    "accountId": "012345678901",
    "locale": "en",
    "timezone": {
      "label": "UTC",
      "offsetISO": "+00:00",
      "offsetInMinutes": 0
    },
    "period": 300,
    "isAutoPeriod": true,
    "timeRange": {
      "mode": "relative",
      "start": 1627236199729,
      "end": 1627322599729,
      "relativeStart": 86400012,
      "zoom": {
        "start": 1627276030434,
        "end": 1627282956521
      }
    },
    "theme": "light",
    "linkCharts": true,
    "title": "Tweets for Amazon website problem",
    "forms": {
      "all": {}
    },
    "params": {
      "original": "param-to-widget"
    },
    "width": 588,
    "height": 369
  }
}
```

## Default CSS styling


Custom widgets provide the following default CSS styling elements:
+ You can use the CSS class **btn** to add a button. It turns an anchor (`<a>`) into a button as in the following example:

  ```
  <a class="btn" href=https://amazon.com”>Open Amazon</a>
  ```
+ You can use the CSS class **btn btn-primary** to add a primary button.
+ The following elements are styled by default: **table**, **select**, **headers (h1, h2, and h3)**, **preformatted text (pre)**, **input**, and **text area**.

## Using the describe parameter


We strongly recommend that you support the **describe** parameter in your functions, even if it just returns an empty string. If you don't support it, and it is called in the custom widget, it displays widget content as if it was documentation.

If you include the **describe** parameter, the Lambda function returns the documentation in Markdown format and does nothing else.

When you create a custom widget in the console, after you select the Lambda function a **Get documentation** button appears. If you choose this button, the function is invoked with the **describe** parameter and the function's documentation is returned. If the documentation is well-formatted in markdown, CloudWatch parses the first entry in the documentation that is surrounded by three single backtick characters (```) in YAML. Then, it automatically populates the documentation in the parameters. The following is an example of such well-formatted documentation. 

```
``` yaml
echo: <h1>Hello world</h1>
```
```

# Security and JavaScript for custom CloudWatch widgets
Security and JavaScript

For security reasons, JavaScript is not allowed in the returned HTML. Removing the JavaScript prevents permission escalation issues, where the writer of the Lambda function injects code that could run with higher permissions than the user viewing the widget on the dashboard.

If the returned HTML contains any JavaScript code or other known security vulnerabilities, it is cleaned from the HTML before it is rendered on the dashboard. For example, the **<iframe>** and **<use>** tags are not allowed and are removed.

Custom Widgets won't run by default in a dashboard. Instead, you must explicitly allow a custom widget to run if you trust the Lambda function that it invokes. You can choose to allow it once or allow always, for both individual widgets and entire dashboard. You can also deny permission for individual widgets and the entire dashboard.

# Interactivity in the custom widget in CloudWatch
Interactivity in custom widgets

Even though JavaScript is not allowed, there are other ways to allow interactivity with the returned HTML.
+ Any element in the returned HTML can be tagged with special configuration in a `<cwdb-action>` tag, which can display information in pop-ups, ask for confirmation on clicks, and call any Lambda function when that element is chosen. For example, you can define buttons that call any AWS API using a Lambda function. The returned HTML can be set to either replace the existing Lambda widget's content, or display inside a modal.
+ The returned HTML can include links that open new consoles, open other customer pages, or load other dashboards.
+ The HTML can include the `title` attribute for an element, which gives additional information if the user hovers over that element.
+ The element can include CSS selectors, such as `:hover`, which can invoke animations or other CSS effects. You can also show or hide elements in the page.

## <cwdb-action> definition and usage


The `<cwdb-action>` element defines a behavior on the immediately previous element. The content of the `<cwdb-action>` is either HTML to display or a JSON block of parameters to pass to a Lambda function.

The following is an example of a `<cwdb-action>` element.

```
<cwdb-action 
     action="call|html" 
     confirmation="message" 
     display="popup|widget" 
     endpoint="<lambda ARN>" 
     event="click|dblclick|mouseenter">  
 
     html | params in JSON
</cwdb-action>
```
+ **action**— Valid values are `call`, which calls a Lambda function, and `html`, which displays any HTML contained within `<cwdb-action>`. The default is `html`.
+ **confirmation**— Displays a confirmation message that must be acknowledged before the action is taken, allowing the customer to cancel.
+ **display**— Valid values are `popup` and `widget`, which replaces the content of the widget itself. The default is `widget`.
+ **endpoint**— The Amazon Resource Name (ARN) of the Lambda function to call. This is required if `action` is `call`.
+ **event**— Defines the event on the previous element that invokes the action. Valid values are `click`, `dblclick`, and `mouseenter`. The `mouseenter` event can be used only in combination with the `html` action. The default is `click`. 

**Examples**

The following is an example of how to use the `<cwdb-action>` tag to create a button that reboots an Amazon EC2 instance using a Lambda function call. It displays the success or failure of the call in a pop-up.

```
<a class="btn">Reboot Instance</a>
<cwdb-action action="call" endpoint="arn:aws:lambda:us-east-1:123456:function:rebootInstance" display="popup">  
       { "instanceId": "i-342389adbfef" }
</cwdb-action>
```

The next example displays more information in a pop-up.

```
<a>Click me for more info in popup</a>
<cwdb-action display="popup"> 
   <h1>Big title</h1>
   More info about <b>something important</b>.
</cwdb-action>
```

This example is a **Next** button that replaces the content of a widget with a call to a Lambda function.

```
<a class="btn btn-primary">Next</a>
<cwdb-action action="call" endpoint="arn:aws:lambda:us-east-1:123456:function:nextPage"> 
   { "pageNum": 2 }
</cwdb-action>
```

# Creating a custom widget for a CloudWatch dashboard
Creating a custom widget

To create a custom widget, you can use one of the samples provided by AWS, or you can create your own. The AWS samples include samples in both JavaScript and Python, and are created by a AWS CloudFormation stack. For a list of samples, see [Sample custom widgets for a CloudWatch dashboard](add_custom_widget_samples.md).

**To create a custom widget in a CloudWatch dashboard**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1. In the navigation pane, choose **Dashboards**, and then choose a dashboard.

1. Choose the **\$1** symbol.

1. Choose **Custom widget**.

1. Use one of the following methods:
   + To use a sample custom widget provided by AWS, do the following:

     1. Select the sample in the dropdown box.

        The CloudFormation console launches in a new browser. In the CloudFormation console, do the following:

     1. (Optional) Customize the CloudFormation stack name.

     1. Make selections for any parameters used by the sample.

     1. Select **I acknowledge that AWS CloudFormation might create IAM resources**, and choose **Create stack**.
   + To create your own custom widget provided by AWS, do the following:

     1. Choose **Next**.

     1. Choose to either select your Lambda function from a list, or enter its Amazon Resource Name (ARN). If you select it from a list, also specify the Region where the function is and the version to use.

     1. For **Parameters**, make selections for any parameters used by the function.

     1. Enter a title for the widget.

     1. For **Update on**, configure when the widget should be updated (when the Lambda function should be called again). This can be one or more of the following: **Refresh** to update it when the dashboard auto-refreshes, **Resize** to update it whenever the widget is resized, or **Time Range** to update it whenever the dashboard's time range is adjusted, including when graphs are zoomed into.

     1. If you are satisfied with the preview, choose **Create widget**.

# Sample custom widgets for a CloudWatch dashboard
Sample custom widgets

AWS provides sample custom widgets in both JavaScript and Python. You can create these sample widgets by using the link for each widget in this list. Alternatively, you can create and customize a widget by using the CloudWatch console. The links in this list open an AWS CloudFormation console and use an CloudFormation quick-create link to create the custom widget.

You can also access the custom widget samples on [GitHub](https://github.com/aws-samples/cloudwatch-custom-widgets-samples).

Following this list, complete examples of the Echo widget are shown for each language.

------
#### [ JavaScript ]

**Sample custom widgets in JavaScript**
+ [ Echo](https://console.aws.amazon.com/cloudwatch/cfn.js?region=us-east-1&action=create&stackName=customWidgetEcho-js&template=customWidgets/customWidgetEcho-js.yaml&param_DoCreateExampleDashboard=Yes) – A basic echoer that you can use to test how HTML appears in a custom widget, without having to write a new widget.
+ [ Hello world](https://console.aws.amazon.com/cloudwatch/cfn.js?region=us-east-1&action=create&stackName=customWidgetHelloWorld-js&template=customWidgets/customWidgetHelloWorld-js.yaml&param_DoCreateExampleDashboard=Yes) – A very basic starter widget.
+ [ Custom widget debugger](https://console.aws.amazon.com/cloudwatch/cfn.js?region=us-east-1&action=create&stackName=customWidgetDebugger-js&template=customWidgets/customWidgetDebugger-js.yaml&param_DoCreateExampleDashboard=Yes) – A debugger widget that displays useful information about the Lambda runtime environment.
+ [ Query CloudWatch Logs Insights](https://console.aws.amazon.com/cloudwatch/cfn.js?region=us-east-1&action=create&stackName=customWidgetLogsInsightsQuery-js&template=customWidgets/customWidgetLogsInsightsQuery-js.yaml&param_DoCreateExampleDashboard=Yes) – Run and edit CloudWatch Logs Insights queries.
+ [ Run Amazon Athena queries](https://console.aws.amazon.com/cloudwatch/cfn.js?region=us-east-1&action=create&stackName=customWidgetAthenaQuery-js&template=customWidgets/customWidgetAthenaQuery-js.yaml&param_DoCreateExampleDashboard=Yes) – Run and edit Athena queries.
+ [ Call AWS API](https://console.aws.amazon.com/cloudwatch/cfn.js?region=us-east-1&action=create&stackName=customWidgetAwsCall-js&template=customWidgets/customWidgetAwsCall-js.yaml&param_DoCreateExampleDashboard=Yes) – Call any read-only AWS API and display the results in JSON format.
+ [ Fast CloudWatch bitmap graph](https://console.aws.amazon.com/cloudwatch/cfn.js?region=us-east-1&action=create&stackName=customWidgetCloudWatchBitmapGraph-js&template=customWidgets/customWidgetCloudWatchBitmapGraph-js.yaml&param_DoCreateExampleDashboard=Yes) – Render CloudWatch graphs using on the server side, for fast display.
+ [ Text widget from CloudWatch dashboard](https://console.aws.amazon.com/cloudwatch/cfn.js?region=us-east-1&action=create&stackName=customWidgetIncludeTextWidget-js&template=customWidgets/customWidgetIncludeTextWidget-js.yaml&param_DoCreateExampleDashboard=Yes) – Displays the first text widget from the specified CloudWatch dashboard.
+ [ CloudWatch metric data as a table](https://console.aws.amazon.com/cloudwatch/cfn.js?region=us-east-1&action=create&stackName=customWidgetCloudWatchMetricDataTable-js&template=customWidgets/customWidgetCloudWatchMetricDataTable-js.yaml&param_DoCreateExampleDashboard=Yes) – Displays raw CloudWatch metric data in a table.
+ [ Amazon EC2 table](https://console.aws.amazon.com/cloudwatch/cfn.js?region=us-east-1&action=create&stackName=customWidgetEc2Table-js&template=customWidgets/customWidgetEc2Table-js.yaml&param_DoCreateExampleDashboard=Yes) – Displays the top EC2 instances by CPU utilization. This widget also includes a Reboot button, which is disabled by default.
+ [AWS CodeDeploy deployments](https://console.aws.amazon.com/cloudwatch/cfn.js?region=us-east-1&action=create&stackName=customWidgetCodeDeploy-js&template=customWidgets/customWidgetCodeDeploy-js.yaml&param_DoCreateExampleDashboard=Yes) – Displays CodeDeploy deployments.
+ [AWS Cost Explorer report](https://console.aws.amazon.com/cloudwatch/cfn.js?region=us-east-1&action=create&stackName=customWidgetCostExplorerReport-js&template=customWidgets/customWidgetCostExplorerReport-js.yaml&param_DoCreateExampleDashboard=Yes) – Displays a report on the cost of each AWS service for a selected time range.
+ [ Display content of external URL](https://console.aws.amazon.com/cloudwatch/cfn.js?region=us-east-1&action=create&stackName=customWidgetFetchURL-js&template=customWidgets/customWidgetFetchURL-js.yaml&param_DoCreateExampleDashboard=Yes) – Displays the content of an externally accessible URL.
+ [ Display an Amazon S3 object](https://console.aws.amazon.com/cloudwatch/cfn.js?region=us-east-1&action=create&stackName=customWidgetS3GetObject-js&template=customWidgets/customWidgetS3GetObject-js.yaml&param_DoCreateExampleDashboard=Yes) – Displays an object in an Amazon S3 bucket in your account.
+ [ Simple SVG pie chart](https://console.aws.amazon.com/cloudwatch/cfn.js?region=us-east-1&action=create&stackName=customWidgetSimplePie-js&template=customWidgets/customWidgetSimplePie-js.yaml&param_DoCreateExampleDashboard=Yes) – Example of a graphical SVG-based widget.

------
#### [ Python ]

**Sample custom widgets in Python**
+ [ Echo](https://console.aws.amazon.com/cloudwatch/cfn.js?region=us-east-1&action=create&stackName=customWidgetEcho-py&template=customWidgets/customWidgetEcho-py.yaml&param_DoCreateExampleDashboard=Yes) – A basic echoer which you can use to test how HTML appears in a custom widget, without having to write a new widget.
+ [ Hello world](https://console.aws.amazon.com/cloudwatch/cfn.js?region=us-east-1&action=create&stackName=customWidgetHelloWorld-py&template=customWidgets/customWidgetHelloWorld-py.yaml&param_DoCreateExampleDashboard=Yes) – A very basic starter widget.
+ [ Custom widget debugger](https://console.aws.amazon.com/cloudwatch/cfn.js?region=us-east-1&action=create&stackName=customWidgetDebugger-py&template=customWidgets/customWidgetDebugger-py.yaml&param_DoCreateExampleDashboard=Yes) – A debugger widget that displays useful information about the Lambda runtime environment.
+ [ Call AWS API](https://console.aws.amazon.com/cloudwatch/cfn.js?region=us-east-1&action=create&stackName=customWidgetAwsCall-py&template=customWidgets/customWidgetAwsCall-py.yaml&param_DoCreateExampleDashboard=Yes) – Call any read-only AWS API and display the results in JSON format.
+  [ Fast CloudWatch bitmap graph](https://console.aws.amazon.com/cloudwatch/cfn.js?region=us-east-1&action=create&stackName=customWidgetCloudWatchBitmapGraph-py&template=customWidgets/customWidgetCloudWatchBitmapGraph-py.yaml&param_DoCreateExampleDashboard=Yes) – Render CloudWatch graphs using on the server side, for fast display.
+  [ Send dashboard snapshot by email](https://console.aws.amazon.com/cloudwatch/cfn.js?region=us-east-1&action=create&stackName=customWidgetEmailDashboardSnapshot-py&template=customWidgets/customWidgetEmailDashboardSnapshot-py.yaml&param_DoCreateExampleDashboard=Yes) – Take a snapshot of the current dashboard and send it to email recipients.
+  [ Send dashboard snapshot to Amazon S3](https://console.aws.amazon.com/cloudwatch/cfn.js?region=us-east-1&action=create&stackName=customWidgetSnapshotDashboardToS3-py&template=customWidgets/customWidgetSnapshotDashboardToS3-py.yaml&param_DoCreateExampleDashboard=Yes) – Take a snapshot of the current dashboard and store it in Amazon S3.
+ [ Text widget from CloudWatch dashboard](https://console.aws.amazon.com/cloudwatch/cfn.js?region=us-east-1&action=create&stackName=customWidgetIncludeTextWidget-py&template=customWidgets/customWidgetIncludeTextWidget-py.yaml&param_DoCreateExampleDashboard=Yes) – Displays the first text widget from the specified CloudWatch dashboard.
+ [ Display content of external URL](https://console.aws.amazon.com/cloudwatch/cfn.js?region=us-east-1&action=create&stackName=customWidgetFetchURL-py&template=customWidgets/customWidgetFetchURL-py.yaml&param_DoCreateExampleDashboard=Yes) – Displays the content of an externally accessible URL.
+ [ RSS reader](https://console.aws.amazon.com/cloudwatch/cfn.js?region=us-east-1&action=create&stackName=customWidgetRssReader-py&template=customWidgets/customWidgetRssReader-py.yaml&param_DoCreateExampleDashboard=Yes) – Displays RSS feeds.
+ [ Display an Amazon S3 object](https://console.aws.amazon.com/cloudwatch/cfn.js?region=us-east-1&action=create&stackName=customWidgetS3GetObject-py&template=customWidgets/customWidgetS3GetObject-py.yaml&param_DoCreateExampleDashboard=Yes) – Displays an object in an Amazon S3 bucket in your account.
+ [ Simple SVG pie chart](https://console.aws.amazon.com/cloudwatch/cfn.js?region=us-east-1&action=create&stackName=customWidgetSimplePie-py&template=customWidgets/customWidgetSimplePie-py.yaml&param_DoCreateExampleDashboard=Yes) – Example of a graphical SVG-based widget.

------

**Echo widget in JavaScript**

The following is the Echo sample widget in JavaScript.

```
const DOCS = `
## Echo
A basic echo script. Anything passed in the \`\`\`echo\`\`\` parameter is returned as the content of the custom widget.
### Widget parameters
Param | Description
---|---
**echo** | The content to echo back
 
### Example parameters
\`\`\` yaml
echo: <h1>Hello world</h1>
\`\`\`
`;
 
exports.handler = async (event) => {
    if (event.describe) {
        return DOCS;   
    }
    
    let widgetContext = JSON.stringify(event.widgetContext, null, 4);
    widgetContext = widgetContext.replace(/</g, '&lt;');
    widgetContext = widgetContext.replace(/>/g, '&gt;');
    
    return `${event.echo || ''}<pre>${widgetContext}</pre>`;
};
```

**Echo widget in Python**

The following is the Echo sample widget in Python.

```
import json
     
DOCS = """
## Echo
A basic echo script. Anything passed in the ```echo``` parameter is returned as the content of the custom widget.
### Widget parameters
Param | Description
---|---
**echo** | The content to echo back
     
### Example parameters
``` yaml
echo: <h1>Hello world</h1>
```"""
 
def lambda_handler(event, context):
    if 'describe' in event:
        return DOCS
        
    echo = event.get('echo', '')
    widgetContext = event.get('widgetContext')
    widgetContext = json.dumps(widgetContext, indent=4)
    widgetContext = widgetContext.replace('<', '&lt;')
    widgetContext = widgetContext.replace('>', '&gt;')
        
    return f'{echo}<pre>{widgetContext}</pre>'
```

**Echo widget in Java**

The following is the Echo sample widget in Java.

```
package example;
 
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestHandler;
 
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
 
public class Handler implements RequestHandler<Event, String>{
 
  static String DOCS = ""
    + "## Echo\n"
    + "A basic echo script. Anything passed in the ```echo``` parameter is returned as the content of the custom widget.\n"
    + "### Widget parameters\n"
    + "Param | Description\n"
    + "---|---\n"
    + "**echo** | The content to echo back\n\n"
    + "### Example parameters\n"
    + "```yaml\n"
    + "echo: <h1>Hello world</h1>\n"
    + "```\n";
 
  Gson gson = new GsonBuilder().setPrettyPrinting().create();
 
  @Override
  public String handleRequest(Event event, Context context) {
 
    if (event.describe) {
      return DOCS;
    }
     
    return (event.echo != null ? event.echo : "") + "<pre>" + gson.toJson(event.widgetContext) + "</pre>";
  }
}
     
class Event {
 
    public boolean describe;
    public String echo;
    public Object widgetContext;
 
    public Event() {}
 
    public Event(String echo, boolean describe, Object widgetContext) {
        this.describe = describe;
        this.echo = echo;
        this.widgetContext = widgetContext;
    }
}
```

# Adding a text widget to a CloudWatch dashboard
Adding a text widget

**To add a text widget to a dashboard**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1. In the navigation pane, choose **Dashboards**, and then choose a dashboard.

1. Choose the **\$1** symbol.

1. Choose **Text**.

1. For **Markdown**, add and format your text using [Markdown](https://docs.aws.amazon.com/general/latest/gr/aws-markdown.html) and choose **Create widget**.

1. To make the text widget transparent, choose **Transparent background**.

1. Choose **Save dashboard**.

# Editing a text widget on a CloudWatch dashboard
Editing a text widget

**To edit a text widget on a dashboard**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1. In the navigation pane, choose **Dashboards**, and then choose a dashboard.

1. Hover over the upper-right corner of the text block and choose **Widget actions**. Then, choose **Edit**.

1. Update the text as needed and choose **Update widget**.

1. Choose **Save dashboard**.

# Removing a text widget from a CloudWatch dashboard
Removing a text widget

**To remove a text widget from a dashboard**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1. In the navigation pane, choose **Dashboards**, and then choose a dashboard.

1. Hover over the upper-right corner of the text block and choose **Widget actions**. Then, choose **Delete**.

1. Choose **Save dashboard**.

# Adding an alarm to a CloudWatch dashboard
Adding an alarm

**To add a single alarm, including its graph, to a dashboard**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1. In the navigation pane, choose **Alarms**, select the alarm to add, and then choose **Add to Dashboard**.

1. Select a dashboard, choose a widget type (**Line**, **Stacked area**, or **Number**), and then choose **Add to dashboard**.

1. To see your alarm on the dashboard, choose **Dashboards** in the navigation pane and select the dashboard.

1. (Optional) To temporarily make an alarm graph larger, select the graph.

1. (Optional) To change the widget type, hover over the title of the graph, choose **Widget actions**, and then choose **Widget type**.

# Adding an alarm status widget to a CloudWatch dashboard
Adding an alarm status widget

**To add an alarm status widget to a dashboard**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1. In the navigation pane, choose **Dashboards**, and then choose a dashboard.

1. Choose the **\$1** symbol.

1. Choose **Alarm status**.

1. Select the check boxes next to the alarms that you want to add to the widget, and then choose **Create widget**.

1. Choose **Add to dashboard**.

# Removing an alarm widget from a CloudWatch dashboard
Removing an alert widget

**To remove an alarm widget from a dashboard**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1. In the navigation pane, choose **Dashboards**, and then choose a dashboard.

1. Hover over the widget, choose **Widget actions**, and then choose **Delete**.

1. Choose **Save dashboard**. If you attempt to navigate away from the dashboard before you save your changes, you're prompted to either save or discard your changes.

# Using a data table widget in a CloudWatch dashboard
Using a data table widget

**Table properties**

A data table has a default set of properties that don’t require any changes to be made to the options or source. These properties include a sticky label column, all summary columns enabled, datapoints rounded, and their units converted.

Each data table widget can have the following properties. The information about each property includes how to configure it in the JSON source of the dashboard. For more information about dashboard JSON, see [ Dashboard Body Structure and Syntax](https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/CloudWatch-Dashboard-Body-Structure.html).

**Summary**  
Summary columns are a new property introduced with the data table widget. These columns are a specific subset of summaries of your current table. For example, the **Sum** summary is a sum of all displayed datapoints in its row. The summary columns are not the same as CloudWatch statistics. Represented in source as:  

```
 "table": {
        "summaryColumns": [
            "MIN",
            "MAX",
            "SUM",
            "AVG"
        ]
    },
```

**Thresholds**  
Use this to apply thresholds to your table. When a data point falls within a threshold, its cell is highlighted with the threshold color. Represented in source as:  

```
"annotations": {
    "horizontal": [
        {
            "label": string,
            "value": int,
            "fill": "above" | "below"
        }
    ]
}
```

Unit in label column  
To display what unit is associated with the metric, you can enable this option to display the unit in the label column beside the label. Represented in source as:  

```
"yAxis": {
    "left": {
        "showUnits": true | false
    }
}
```

**Invert rows and columns**  
This transforms the table so that the datapoints swap from columns to rows, and the metrics become columns. Represented in source as:  

```
 "table": {
    "layout": "vertical" | "horizontal"
}
```

**Sticky summary columns**  
This makes the summary columns sticky, so that they remain in view while you scroll. The label is already sticky. Represented in source as:  

```
"table": {
    "stickySummary": true | false
}
```

**Display only summary columns**  
This prevents the columns of datapoints from being displayed, so that only the label and summary columns are displayed. Represented in source as:  

```
 "table": {
    "showTimeSeriesData": false | true
}
```

**Live data**  
Displays the most recent data point, even if it is not yet fully aggregated. Represented in source as:  

```
"liveData": true | false
```

**Number widget format**  
Displays as many digits as can fit in the cell, before rounding and converting. Represented in source as:  

```
"singleValueFullPrecision": true | false
```

# Adding a data table widget to a CloudWatch dashboard
Adding a data table widget

**To add a data table widget to a dashboard**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1. In the navigation pane, choose **Dashboards** and then choose a dashboard.

1. Choose the **\$1** button, select **Data table**, and choose **Next**.

1. In the **Browse** tab, search or browse for the metrics that you want to display in the table widget. Then select the metrics.

1. (Optional) To change the layout of the table, choose the **Options** tab and select **Invert rows and columns**.

   You can also use the **Options** tab to change what columns appear in the table and display the unit being used in the **Label** column.
**Tip**  
To display more accurate thresholds, choose **Show as many digits as can fit before rounding**.

1. (Optional) To change your data table widget's time range, select one of the predefined time ranges in the upper area of the widget. The time ranges span from 1 hour to 1 week. To set your own time range, choose **Custom**.

1. (Optional) To change your data table widget's time range, select one of the predefined time ranges in the upper area of the widget. The time ranges span from 1 hour to 1 week. To set your own time range, choose **Custom**.

1. (Optional) To have this widget keep using the time range that you select, even if the time range for the rest of the dashboard is later changed, choose **Persist time range**.

1. Choose **Create widget** and then choose **Save dashboard**.

# Removing a data table widget from a CloudWatch dashboard
Removing a data table widget

**To remove a data table widget to a dashboard**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1. In the navigation pane, choose **Dashboards**, and then choose a dashboard.

1. In the upper-right corner of the widget that you want to remove, choose **Widget actions**, **Delete**.

1. Choose **Save dashboard**.

# Linking graphs on a CloudWatch dashboard
Linking graphs

Link graphs on a CloudWatch dashboard so that changes in time are reflected on all graphs.

**To link the graphs on a dashboard**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1. In the navigation pane, choose **Dashboards**, and then choose a dashboard.

1. Choose **Actions** and then **Link graphs**.

# Unlinking graphs on a CloudWatch dashboard
Unlinking graphs

**To unlink the graphs on a dashboard**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1. In the navigation pane, choose **Dashboards**, and then choose a dashboard.

1. Clear **Actions** and then **Link graphs**.