

# Using Amazon CloudWatch dashboards
Dashboards

Amazon CloudWatch includes automatic pre-built dashboards and also enables you to create your own dashboards. Dashboards help you to monitor your resources in a single view, even those resources that are spread across different Regions. You can use CloudWatch dashboards to create customized views of the telemetry data for your AWS resources.

With customizable dashboards, you can create the following:
+ A single view for selected metrics and alarms to help you assess the health of your resources and applications across one or more Regions. You can select the color used for each metric on each graph, so that you can easily track the same metric across multiple graphs.
+ An operational playbook that provides guidance for team members during operational events about how to respond to specific incidents.
+ A common view of critical resource and application measurements that can be shared by team members for faster communication flow during operational events.

If you have multiple AWS accounts, you can set up *CloudWatch cross-account observability* and then create rich cross-account dashboards in your monitoring accounts. You can seamlessly search, visualize, and analyze your metrics, logs, and traces without account boundaries.

With CloudWatch cross-account observability, you can do the following in a dashboard in a monitoring account:
+ Search, view, and create graphs of metrics that reside in source accounts. A single graph can include metrics from multiple accounts.
+ Create alarms in the monitoring account that watch metrics in source accounts.
+ View the log events from log groups located in source accounts, and run CloudWatch Logs Insights queries of log groups in source accounts. A single CloudWatch Logs Insights query in a monitoring account can query multiple log groups in multiple source accounts at once.
+ View nodes from source accounts in a trace map in X-Ray. You can then filter the map to specific source accounts.

When you are signed in to a monitoring account, a blue **Monitoring account** badge appears at the top right of every page that supports CloudWatch cross-account observability functionality.

For more information about setting up CloudWatch cross-account observability, see [CloudWatch cross-account observability](CloudWatch-Unified-Cross-Account.md).

 You can create dashboards from the console or using the AWS CLI or `PutDashboard` API operation. You can add dashboards to a favorites list, where you can access not only your favorite dashboards, but also your recently visited dashboards. For more information, see [Add a dashboard to your favorites list](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/add-dashboard-to-favorites.html). 

To access CloudWatch dashboards, you need one of the following:
+ The `AdministratorAccess` policy
+ The `CloudWatchFullAccess` policy
+ A custom policy that includes one or more of these specific permissions:
  + `cloudwatch:GetDashboard` and `cloudwatch:ListDashboards` to be able to view dashboards
  + `cloudwatch:PutDashboard` to be able to create or modify dashboards
  + `cloudwatch:DeleteDashboards` to be able to delete dashboards

**Topics**
+ [Getting started with automatic dashboards](GettingStarted.md)
+ [Creating a customized dashboard](create_dashboard.md)
+ [Creating a cross-account cross-Region dashboard with the console](create_xaxr_dashboard.md)
+ [

## Create a cross-account cross-Region dashboard programmatically
](#create_xaxr_dashboard_API)
+ [Creating a graph with metrics from different accounts and Regions](#create-graph-xaxr-dashboard)
+ [Adding an alarm from a different account to a cross-account dashboard](create-alarm-xaxr-dashboard.md)
+ [Creating dashboards with variables](cloudwatch_dashboard_variables.md)
+ [Using widgets on dashboards](create-and-work-with-widgets.md)
+ [Sharing dashboards](cloudwatch-dashboard-sharing.md)
+ [Using live data](cloudwatch-live-data.md)
+ [Viewing an animated dashboard](cloudwatch-animated-dashboard.md)
+ [Add a dashboard to your favorites list](add-dashboard-to-favorites.md)
+ [Changing the period override setting or refresh interval](change_dashboard_refresh_interval.md)
+ [Changing the time range or time zone format](change_dashboard_time_format.md)

# Getting started with CloudWatch automatic dashboards
Getting started with automatic dashboards

The CloudWatch home page automatically displays metrics about every AWS service you use. You can additionally create custom dashboards to display metrics about your custom applications, and display custom collections of metrics that you choose.

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

The CloudWatch overview home page appears.

![\[An example of a CloudWatch overview home page, showing alarms and their current state, and examples of other metrics graph widgets that might appear on the overview home page.\]](http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/images/CW-default-dashboard-update.png)


The overview displays the following items, refreshed automatically.
+ **Alarms by AWS service** displays a list of AWS services you use in your account, along with the state of alarms in those services. Next to that, two or four alarms in your account are displayed. The number depends on how many AWS services you use. The alarms shown are those in the ALARM state or those that most recently changed state.

  These upper areas help you quickly assess the health of your AWS services, by seeing the alarm states in every service and the alarms that most recently changed state. This helps you monitor and quickly diagnose issues.
+ Below these areas is the *default dashboard*, if one exists. The default dashboard is a custom dashboard that you have created and named **CloudWatch-Default**. This is a convenient way for you to add metrics about your own custom services or applications to the overview page, or to bring forward additional key metrics from AWS services that you most want to monitor.

**Note**  
The automatic dashboards on the CloudWatch home page display only information from the current account, even if the account is a monitoring account set up for CloudWatch cross-account observability. For information about creating custom cross-account dashboards, see [Creating a CloudWatch cross-account cross-Region dashboard with the AWS Management Console](create_xaxr_dashboard.md).

From this overview, you can see a cross-service dashboard of metrics from multiple AWS service, or focus your view to a specific resource group or a specific AWS service. This enables you to narrow your view to a subset of resources in which you are interested. 

**Topics**
+ [

# Viewing the cross-service CloudWatch dashboard
](CloudWatch_Automatic_Dashboards_Cross_Service.md)
+ [

# Removing a service from appearing in the CloudWatch cross-service dashboard
](Remove_service_from_Cross_Service_Dashboard.md)
+ [

# Viewing a CloudWatch dashboard for a single AWS service
](CloudWatch_Automatic_Dashboards_Focus_Service.md)
+ [

# Viewing a CloudWatch dashboard for a resource group
](CloudWatch_Automatic_Dashboards_Resource_Group.md)

# Viewing the cross-service CloudWatch dashboard
Viewing the cross-service dashboard

 You can switch to the Cross-service dashboard screen and interact with dashboards for all of the AWS services that you're using. The CloudWatch Console displays your dashboards in alphabetical order and displays one or two key metrics from each service. 

**Note**  
 If you're using five or more AWS services, the CloudWatch Console won't display the Cross-service dashboard on the Overview screen. 

**To view the Cross-service dashboard**

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

    You're directed to the Overview screen. 

1.  From the Overview screen, select the dropdown that reads **Overview**, and then choose **Cross service dashboard**.

    You're directed to the Cross service dashboard screen. 

1.  (Optional) If you're using the original interface, scroll to the section **Cross-service dashboard**, and then choose **View Cross-service dashboard**. 

    You're directed to the Cross-service dashboard screen. 

1. You can focus on a particular service in two ways:

   1. To see more key metrics for a service, choose its name from the list at the top of the screen, where **Cross service dashboard** is currently shown. Or, you can choose **View *Service* dashboard** next to the service name.

      An automatic dashboard for that service is displayed, showing more metrics for that service. Additionally, for some services, the bottom of the service dashboard displays resources related to that service. You can choose one of those resources to that service console and focus further on that resource.

   1. To see all the alarms related to a service, choose the button on the right of the screen next to that service name. The text on this button indicates how many alarms you have created in this service, and whether any are in the ALARM state.

      When the alarms are displayed, multiple alarms that have similar settings (such as dimensions, threshold, or period) may be shown in a single graph.

      You can then view details about an alarm and see the alarm history. To do so, hover on the alarm graph, and choose the actions icon, **View in alarms**.

      The alarms view appears in a new browser tab, displaying a list of your alarms, along with details about the chosen alarm. To see the history for this alarm, choose the **History** tab.

1. You can focus on resources in a particular resource group. To do so, choose the resource group from the list at the top of the page where **All resources** is displayed.

   For more information, see [Viewing a CloudWatch dashboard for a resource group](CloudWatch_Automatic_Dashboards_Resource_Group.md).

1. To change the time range shown in all graphs and alarms currently displayed, select the range you want next to **Time range** at the top of the screen. Choose **custom** to select from more time range options than those displayed by default.

1. Alarms are always refreshed once a minute. To refresh the view, choose the refresh icon (two curved arrows) at the top right of the screen. To change the automatic refresh rate for items on the screen other than alarms, choose the down arrow next to the refresh icon and choose the refresh rate you want. You can also choose to turn off automatic refresh.

# Removing a service from appearing in the CloudWatch cross-service dashboard
Removing a service from appearing in the cross-service dashboard

You can prevent a service's metrics from appearing in the cross-service dashboard. This helps you focus your cross-service dashboard on the services you most want to monitor.

If you remove a service from the cross-service dashboard, the alarms for that service still appear in the views of your alarms.

**To remove a service's metrics from the cross-service dashboard**

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

   The home page appears.

1. At the top of the page, under **Overview**, choose the service you want to remove.

   The view changes to show metrics from only that service.

1. Choose **Actions**, then clear the check box next to **Show on cross service dashboard**.

# Viewing a CloudWatch dashboard for a single AWS service
Viewing a dashboard for a single service

On the CloudWatch home page, you can focus the view to a single AWS service. You can drill down further by focusing on both a single AWS service and a resource group at the same time. The following procedure shows only how to focus on an AWS service.

**To focus on a single service**

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

   The home page appears.

1. For **Overview**, where **Overview** is currently shown in the drop down menu, choose **Service dashboards**.

1. Choose the service that you want to focus on.

   The view changes to display graphs of key metrics from the selected service.

1. To switch to viewing the alarms for this service, select the check box for **In alarm**, **Insufficient data**, or **OK** near the top of the screen where the service name is currently displayed.

1. When viewing metrics, you can focus on a particular metric in several ways:

   1. To see more details about the metrics in any graph, hover on the graph, and choose the actions icon, **View in metrics**.

      The graph appears in a new tab, with the relevant metrics listed below the graph. You can customize your view of this graph, changing the metrics and resources shown, the statistic, the period, and other factors to get a better understanding of the current situation.

   1. You can view log events from the time range shown in the graph. This may help you discover events that happened in your infrastructure that are causing an unexpected change in your metrics.

      To see the log events, hover on the graph, and choose the actions icon, **View in logs**.

      The CloudWatch Logs view appears in a new tab, displaying a list of your log groups. To see the log events in one of these log groups that occurred during the time range shown in the original graph, choose that log group.

1. When viewing alarms, you can focus on a particular alarm in several ways:

   1. To see more details about an alarm, hover on the alarm, and choose the actions icon, **View in alarms**.

     The alarms view appears in a new tab, displaying a list of your alarms, along with details about the chosen alarm. To see the history for this alarm, choose the **History** tab.

1. Alarms are always refreshed one time per minute. To refresh the view, choose the refresh icon (two curved arrows) at the top right of the screen. To change the automatic refresh rate for items on the screen other than alarms, choose the down arrow next to the refresh icon and choose a refresh rate. You can also choose to turn off automatic refresh.

1. To change the time range shown in all graphs and alarms currently displayed, next to **Time range** at the top of the screen, choose the range. To select from more time range options than those displayed by default, choose **custom**.

1. To return to the cross-service dashboard, choose **Overview** in the list at the top of the screen that currently shows the service you are focusing on.

   Alternatively, from any view, you can choose **CloudWatch** at the top of the screen to clear all filters and return to the overview page.

# Viewing a CloudWatch dashboard for a resource group
Viewing a dashboard for a resource group

You can focus your view to display metrics and alarms from a single resource group. Using resource groups enables you to use tags to organize projects, focus on a subset of your architecture, or distinguish between your production and development environments. They also enable you to focus on each of these resource groups on the CloudWatch overview. For more information, see [What Is AWS Resource Groups?](https://docs.aws.amazon.com/ARG/latest/userguide/welcome.html).

When you focus on a resource group, the display changes to show only the services where you have tagged resources as part of this resource group. The recent alarms area shows only the alarms that are associated with resources that are part of the resource group. Additionally, if you have created a dashboard with the name **CloudWatch-Default-*ResourceGroupName***, it is displayed in the **Default dashboard** area.

You can drill down further by focusing on both a single AWS service and a resource group at the same time. The following procedure shows just how to focus on a resource group.

**To focus on a single resource group**

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

1. At the top of the page, where **All resources** is displayed, choose a resource group.

1. To see more metrics related to this resource group, near the bottom of the screen, choose **View cross service dashboard**.

   The cross-service dashboard appears, showing only the services related to this resource group. For each service, one or two key metrics are displayed.

1. To change the time range shown in all graphs and alarms currently displayed, for **Time range** at the top of the screen, select a range. To select from more time range options than those displayed by default, choose **custom**.

1. Alarms are always refreshed one time per minute. To refresh the view, choose the refresh icon (two curved arrows) at the top right of the screen. To change the automatic refresh rate for items on the screen other than alarms, choose the down arrow next to the refresh icon and choose a refresh rate. You can also choose to turn off automatic refresh.

1. To return to showing information about all the resources in your account, near the top of the screen where the name of the resource group is currently displayed, choose **All resources**. 

# Creating a customized CloudWatch dashboard
Creating a customized dashboard

 To get started, create a CloudWatch dashboard. You can create multiple dashboards, and you can add dashboards to a favorites list. You aren't limited to the number of dashboards that you can have in your AWS account. All dashboards are global. They are not Region-specific. 

 The following procedure shows you how to create a dashboard from the CloudWatch console. You can use the `PutDashboard` API operation to create a dashboard from the command line interface. The API operation contains a JSON string that defines your dashboard content. For more information about creating a dashboard with the `PutDashboard` API operation, see [PutDashboard](https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_PutDashboard.html) in the *Amazon CloudWatch API Reference*. 

**Tip**  
 If you're creating a new dashboard with the `PutDashboard` API operation, you can use the JSON string from a dashboard that already exists. 

**To create a dashboard from the console**

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 **Create dashboard**. 

1. In the **Create new dashboard** dialog box, enter a name for the dashboard, and then choose **Create dashboard**. 

    If you use the name **CloudWatch-Default** or **CloudWatch-Default-*ResourceGroupName***, the dashboard appears in the overview of the CloudWatch home page under **Default Dashboard**. For more information, see [Getting started with CloudWatch automatic dashboards](GettingStarted.md). 

1.  In the **Add to this dashboard** dialog box, do one of the following: 
   +  To add a graph to the dashboard, choose **Line** or **Stacked area**, and then choose **Configure**. In the **Add metric graph** dialog box, select the metric(s) to graph, and then choose **Create widget**. If a metric doesn't appear in the dialog box because it hasn't published data in more than 14 days, you can add it manually. For more information, see [Graph metrics manually on a CloudWatch dashboard](add_old_metrics_to_graph.md). 
   +  To add a number displaying a metric to the dashboard, choose **Number**, and then choose **Configure**. In the **Add metric graph** dialog box, select the metric(s) to graph, and then choose **Create widget**.
   +  To add a text block to the dashboard, choose **Text**, and then choose **Configure**. In the **New text widget** dialog box, for **Markdown**, format your text using [Markdown](https://docs.aws.amazon.com/general/latest/gr/aws-markdown.html), and then choose **Create widget**. 

1.  (Optional) Choose **Add widget**, and then repeat step 4 to add another widget to the dashboard. You can repeat this step multiple times. 

   For each graph on the dashboard, there is an information icon at the upper right. Choose this icon to see the descriptions of the metrics in the graph.

1.  Choose **Save dashboard**. 

# Creating a CloudWatch cross-account cross-Region dashboard with the AWS Management Console
Creating a cross-account cross-Region dashboard with the console

You can create *cross-account cross-Region dashboards*, which summarize your CloudWatch data from multiple AWS accounts and multiple Regions into one dashboard. From this high-level dashboard you can get a view of your entire application, and also drill down into more specific dashboards without having to sign in and out of accounts or switch Regions.

**Prerequisite**  
Before you can create a cross-account cross-Region dashboard, you must enable at least one sharing account and at least one monitoring account. Additionally, to be able to use the CloudWatch console to create a cross-account dashboard, you must enable the console for cross-account functionality. For more information, see [Cross-account cross-Region CloudWatch console](Cross-Account-Cross-Region.md).

**To create a cross-account cross-Region dashboard**

1. Sign in to the monitoring account.

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 a dashboard, or create a new one.

1. At the top of the screen, you can switch between accounts and Regions. As you create your dashboard, you can include widgets from multiple accounts and Regions. Widgets include graphs, alarms, and CloudWatch Logs Insights widgets.

## Create a cross-account cross-Region dashboard programmatically


You can use the AWS APIs and SDKs to create dashboards programmatically. For more information, see [ PutDashboard](https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_PutDashboard).

To enable cross-account cross-Region dashboards, we have added new parameters to the dashboard body structure, as shown in the following table and examples. For more information about overall dashboard body structure, see [ Dashboard Body Structure and Syntax](https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/CloudWatch-Dashboard-Body-Structure.html).


| Parameter | Use | Scope | Default | 
| --- | --- | --- | --- | 
|  `accountId` | Specifies the ID of the account where the widget or the metric is located. |  Widget or metric |  Account that is currently logged in  | 
|  `region` | Specifies the Region of the metric. |  Widget or metric |  Current Region selected in the console  | 

The following examples illustrate the JSON source for widgets in a cross-account cross-Region dashboard.

This example sets the `accountId` field to the ID of the sharing account at the widget level. This specifies that all metrics in this widget will come from that sharing account and Region.

```
{
  "widgets": [
    {
          ...
          "properties": {
        "metrics": [
                   …
        ],
        "accountId": "111122223333",
        "region": "us-east-1"
      }
    }
  ]
}
```

This example sets the `accountId` field differently at the level of each metric. In this example, the different metrics in this metric math expression come from different sharing accounts and different Regions.

```
{
  "widgets": [
    {
          ...
          "properties": {
        "metrics": [
          [
            {
              "expression": "SUM(METRICS())",
              "label": "[avg: ${AVG}] Expression1",
              "id": "e1",
              "stat": "Sum"
            }
          ],
          [
            "AWS/EC2",
            "CPUUtilization",
            {
              "id": "m2",
              "accountId": "5555666677778888",
              "region": "us-east-1",
              "label": "[avg: ${AVG}] ApplicationALabel "
            }
          ],
          [
            ".",
            ".",
            {
              "id": "m1",
              "accountId": "9999000011112222",
              "region": "eu-west-1",
              "label": "[avg: ${AVG}] ApplicationBLabel"
            }
          ]
        ],
        "view": "timeSeries",
        "region": "us-east-1", ---> home region of the metric. Not present in above example 
              "stacked": false,
        "stat": "Sum",
        "period": 300,
        "title": "Cross account example"
      }
    }
  ]
}
```

This example shows an alarm widget.

```
{
  "type": "metric",
  "x": 6,
  "y": 0,
  "width": 6,
  "height": 6,
  "properties": {
    "accountID": "111122223333",
    "title": "over50",
    "annotations": {
      "alarms": [
        "arn:aws:cloudwatch:us-east-1:379642911888:alarm:over50"
      ]
    },
    "view": "timeSeries",
    "stacked": false
  }
}
```

This example is for a CloudWatch Logs Insights widget.

```
{
  "type": "log",
  "x": 0,
  "y": 6,
  "width": 24,
  "height": 6,
  "properties": {
    "query": "SOURCE 'route53test' | fields @timestamp, @message\n| sort @timestamp desc\n| limit 20",
    "accountId": "111122223333",
    "region": "us-east-1",
    "stacked": false,
    "view": "table"
  }
}
```

Another way to create dashboards programmatically is to first create one in the AWS Management Console, and then copy the JSON source of this dashboard. To do so, load the dashboard and choose **Actions**, **View/edit source**. You can then copy this dashboard JSON to use as a template to create similar dashboards.

## Creating a graph with metrics from different accounts and Regions in a CloudWatch dashboard
Creating a graph with metrics from different accounts and Regions

1. Sign in to the monitoring account.

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

1. In the navigation pane, choose **Metrics**, and then choose **All metrics**.

1.  Select the account and Region that you want to add metrics from. You can select your account and Region from the account and Region dropdown menus near the top-right of the screen.

1. Add the metrics you want to the graph. For more information, see [Graphing metrics](graph_metrics.md).

1. Repeat steps 4-5 to add metrics from other accounts and Regions.

1. (Optional) Choose the **Graphed metrics** tab and add a metric math function that uses the metrics that you have chosen. For more information, see [Using math expressions with CloudWatch metrics](using-metric-math.md).

   You can also set up a single graph to include multiple `SEARCH` functions. Each search can refer to a different account or Region.

1. When you are finished with the graph, choose **Actions**, **Add to dashboard**.

   Select your cross-account dashboard, and choose **Add to dashboard**.

# Adding an alarm from a different account to a CloudWatch cross-account dashboard
Adding an alarm from a different account to a cross-account dashboard

1. Sign in to the monitoring account.

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

1. At the top of the page, choose the account where the alarm is located.

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

1. Select the check box next to the alarm that you want to add, and choose **Add to dashboard**.

1. Select the cross-account dashboard that you want to add it to, and choose **Add to dashboard**.

# Creating flexible CloudWatch dashboards with dashboard variables
Creating dashboards with variables

Use *dashboard variables* to create flexible dashboards that can quickly display different content in multiple widgets, depending on the value of an input field within the dashboard. For example, you can create a dashboard that can quickly switch between different Lambda functions or Amazon EC2 instance IDs, or one that can switch to different AWS Regions.

After you create a dashboard that uses a variable, you can copy the same variable pattern to other existing dashboards.

Using dashboard variables improves the operational workflow for people who use your dashboards. It can also reduce your costs because you're using dashboard variables in one dashboard instead of creating multiple similar dashboards. 

**Note**  
If you share a dashboard that contains dashboard variables, the people that you share it with won't be able to change between the variable values.

## Types of dashboard variables


The dashboard variable can be a *property variable* or a *pattern variable*.
+ *Property variables* change all instances of a property in all widgets in the dashboard. This property can be any JSON property in the JSON source of a dashboard, such as `region`. Or it can be a dimension name for a metric, such as `InstanceID` or `FunctionName`.

  For a tutorial that uses a property variable, see [Tutorial: Creating a CloudWatch Lambda dashboard with function name as the variable](cloudwatch_dashboard_variables_property.md). 

  For more information about the JSON source of dashboards, see [Dashboard Body Structure and Syntax](https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/CloudWatch-Dashboard-Body-Structure.html). In the CloudWatch console, you can see the JSON source for any custom dashboard by choosing **Actions**, **View/edit source**.
+ *Pattern variables* use a regular expression pattern to change all of a JSON property or only a certain part of it.

  For a tutorial that uses a pattern variable, see [Tutorial: Creating a dashboard that uses a regular expression pattern to switch between AWS Regions](cloudwatch_dashboard_variables_pattern.md).

Property variables apply to most use cases and are less complex to set up.

**Topics**
+ [

## Types of dashboard variables
](#cloudwatch_dashboard_variables_types)
+ [

# Copying a variable to another CloudWatch dashboard
](cloudwatch_dashboard_variables_copy.md)
+ [

# Tutorial: Creating a dashboard that uses a regular expression pattern to switch between AWS Regions
](cloudwatch_dashboard_variables_pattern.md)
+ [

# Tutorial: Creating a CloudWatch Lambda dashboard with function name as the variable
](cloudwatch_dashboard_variables_property.md)

# Copying a variable to another CloudWatch dashboard
Copying a variable to another dashboard

After you create a dashboard with useful variables, you can copy these variables to other existing dashboards. For more information about dashboard variables, see [Creating flexible CloudWatch dashboards with dashboard variables](cloudwatch_dashboard_variables.md).

**To copy a dashboard variable to another 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 name of the dashboard that has the variable that you want to copy. Enter a string to find dashboards with matching names, if needed. 

1. Choose **Actions**, **Variables**, **Manage variables**.

1. Choose the radio button next to the variable that you want to copy, and choose **Copy to another dashboard**.

1. Choose the selection box and start typing the dashboard name that you want to copy the variable to.

1. Select the dashboard name and choose **Copy variable**.

# Tutorial: Creating a dashboard that uses a regular expression pattern to switch between AWS Regions
Tutorial: Using a regular expression pattern to switch between Regions

The steps in this procedure illustrate how to create a flexible dashboard that can switch between Regions. This tutorial uses a regular expression *pattern variable* instead of a property variable. For a tutorial that uses a property variable, see [Tutorial: Creating a CloudWatch Lambda dashboard with function name as the variable](cloudwatch_dashboard_variables_property.md). 

For many use cases, you can create a dashboard that switches between Regions by using a property variable. But if the widgets rely on Amazon Resource Names (ARNs) that include Region names, you must use a pattern variable to change the Region names within the ARNs.

**To use a dashboard pattern variable to create a flexible multi-Region 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**, **Create dashboard**. 

1.  Enter a name for the dashboard, and choose **Create dashboard**. 

1.  Add widgets to the dashboard. When you add the widgets that you want to display Region-specific data, avoid specifying any dimensions with values that appear in only one Region. For example, for Amazon EC2 metrics, specify metrics that are aggregated instead of metrics that use **InstanceID** as a dimension. 

   For more information about adding widgets to a dashboard, see [Using widgets on CloudWatch dashboards](create-and-work-with-widgets.md).

1. After you add the widgets, as you are viewing the dashboard, choose **Actions**, **Variables**, **Create a variable**.

1. Choose **Pattern variable**.

1. For **Property that the variable changes**, enter the name of the current dashboard Region, such as **us-east-2**.

   You have the correct Region entered if the label below that box displays the widgets that will be impacted by the variable.

1. For **Input type**, for this use case, select **Radio button**. 

1. For **Define how inputs are populated**, choose **Create a list of custom values**.

1. For **Create your custom values**, enter the Regions that you want to switch between, with one Region on each line. After each Region, enter a comma and then the label to display for that radio button. For example:

   **us-east-1, N. Virginia**

   **us-east-2, Ohio**

   **eu-west-3, Paris**

   As you fill in the custom values, the **Preview** pane updates to display what the radio buttons will look like.

1. (Optional) For more settings, choose **Secondary settings** and do one or more of the following:
   + To customize the name of your variable, enter the name in **Custom variable name**.
   + To customize the label for the variable input field, enter the label in **Input label**. For this tutorial, enter **Region:**.

     If you enter a value here, the **Preview** pane updates to display what the radio buttons will look like.
   + To set the default value for this variable when the dashboard is first opened, enter the default in **Default value**.

1. Choose **Add variable**.

   The dashboard appears, with a **Region:** label next to the radio buttons for the Regions near the top. When you switch between Regions, all the widgets that use the variable will display information about the selected Region.

# Tutorial: Creating a CloudWatch Lambda dashboard with function name as the variable
Tutorial: Creating dashboard with the Lambda function name as a variable

The steps in this procedure illustrate how to create a flexible dashboard that shows a variety of metric graphs, using a property variable. This includes a dropdown selection box on the dashboard that you can use to switch the metrics in all the graphs between different Lambda functions. 

Other use case examples for this type of dashboard include using `InstanceId` as the variable to create a dashboard of metrics with a dropdown for instance IDs. Alternatively, you could create a dashboard that uses `region` as the variable to display the same set of metrics from different Regions.

**To use a dashboard property variable to create a flexible Lambda 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**, **Create dashboard**. 

1.  Enter a name for the dashboard, and choose **Create dashboard**. 

1.  Add widgets to the dashboard that display metrics for a Lambda function. When you create these widgets, specify **Lambda**, **By Function Name** for the widget metrics. For the function, specify one of the Lambda functions that you want to include in this dashboard. 

   For more information about adding widgets to a dashboard, see [Using widgets on CloudWatch dashboards](create-and-work-with-widgets.md).

1. After you add the widgets, as you are viewing the dashboard, choose **Actions**, **Variables**, **Create a variable**.

1. Choose **Property variable**.

1. For **Property that the variable changes**, choose **FunctionName**.

1. For **Input type**, for this use case, we recommend choosing **Select menu (dropdown)**. This creates a dropdown menu in the dashboard where you can select the Lambda function name to display metrics for.

   If this was for a dashboard that toggled between only two or three different values for a variable, then **Radio button** would be a good choice.

   If you prefer to enter or paste in values for the variable, you would choose **Text input**. This option doesn't include a dropdown list or radio buttons. 

1. When you choose **Select menu (dropdown)**, you must then choose whether to populate the menu by entering values, or using a metric search. For this use case, let's assume that you have a large number of Lambda functions and you don't want to enter all of them manually. Choose **Use the results of a metric search** and then do the following:

   1. Choose **Pre-built queries**, **Lambda**, **Errors**. 

      (Choosing **Errors** does not add the **Errors** metric to the dashboard. However, it quickly populates the **FunctionName** variable selection box.)

   1. Choose **By Function Name** and then choose **Search**.

      Under the **Search** button, you will then see **FunctionName** selected. You also see a message about how many **FunctionName** dimension values were found to populate the input box.

1. (Optional) For more settings, choose **Secondary settings** and do one or more of the following:
   + To customize the name of your variable, enter the name in **Custom variable name**.
   + To customize the label for the variable input field, enter the label in **Input label**.
   + To set the default value for this variable when the dashboard is first opened, enter the default in **Default value**.

1. Choose **Add variable**.

   A **FunctionName** dropdown selection box appears near the top of the dashboard. You can select a Lambda function in this box and all the widgets that use the variable will display information about the selected function.

   Later, if you add more widgets to the dashboard that watch Lambda metrics with the **FunctionName** dimension, they will automatically use the variable.

# 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**.

# Sharing CloudWatch dashboards
Sharing dashboards

You can share your CloudWatch dashboards with people who do not have direct access to your AWS account. This enables you to share dashboards across teams, with stakeholders, and with people external to your organization. You can even display dashboards on big screens in team areas, or embed them in Wikis and other webpages.

**Warning**  
All people who you share the dashboard with are granted the permissions listed in [Permissions that are granted to people who you share the dashboard with](#share-cloudwatch-dashboard-iamrole) for the account. If you share the dashboard publicly, then everyone who has the link to the dashboard has these permissions.  
The `cloudwatch:GetMetricData` and `ec2:DescribeTags` permissions cannot be scoped down to specific metrics or EC2 instances, so the people with access to the dashboard can query all CloudWatch metrics and the names and tags of all EC2 instances in the account.

When you share dashboards, you can designate who can view the dashboard in three ways:
+ Share a single dashboard and designate as many as five email addresses of people who can view the dashboard. Each of these users creates their own password that they must enter to view the dashboard.
+ Share a single dashboard publicly, so that anyone who has the link can view the dashboard.
+ Share all the CloudWatch dashboards in your account and specify a third-party single sign-on (SSO) provider for dashboard access. All users who are members of this SSO provider's list can access all the dashboards in the account. To enable this, you integrate the SSO provider with Amazon Cognito. The SSO provider must support Security Assertion Markup Language (SAML). For more information about Amazon Cognito, see [ What is Amazon Cognito?](https://docs.aws.amazon.com/cognito/latest/developerguide/what-is-amazon-cognito.html)

Sharing a dashboard doesn't incur charges, but widgets inside a shared dashboard incur charges at standard CloudWatch rates. For more information about CloudWatch pricing, see [Amazon CloudWatch Pricing](https://aws.amazon.com/cloudwatch/pricing/).

When you share a dashboard, Amazon Cognito resources are created in the US East (N. Virginia) Region.

**Important**  
Do not modify resource names and identifiers that are created by the dashboard sharing process. This includes Amazon Cognito and IAM resources. Modifying these resources can cause unexpected and incorrect functionality of shared dashboards.

**Note**  
If you share a dashboard that has metric widgets with alarm annotations, the people that you share the dashboard with will not see those widgets. They will instead see a blank widget with text saying that the widget is not available. You will still see metric widgets with alarm annotations when you view the dashboard yourself.

## Permissions required to share a dashboard


To be able to share dashboards using any of the following methods and to see which dashboards have already been shared, you must be signed on as a user or with an IAM role that has certain permissions.

To be able to share dashboards, your user or IAM role must include the permissions included in the following policy statement:

```
{
    "Effect": "Allow",
    "Action": [
        "iam:CreateRole",
        "iam:CreatePolicy",
        "iam:AttachRolePolicy",
        "iam:PassRole"
    ],
    "Resource": [
        "arn:aws:iam::*:role/service-role/CWDBSharing*",
        "arn:aws:iam::*:policy/*"
    ]
},
{
    "Effect": "Allow",
    "Action": [
        "cognito-idp:*",
        "cognito-identity:*",
    ],
    "Resource": [
        "*"
    ]
},
{
    "Effect": "Allow",
    "Action": [
        "cloudwatch:GetDashboard",
    ],
    "Resource": [
        "*"
        // or the ARNs of dashboards that you want to share
    ]
}
```

To be able to see which dashboards are shared, but not be able to share dashboards, a user or an IAM role can include a policy statement similar to the following:

```
{
    "Effect": "Allow",
    "Action": [
        "cognito-idp:*",
        "cognito-identity:*"
    ],
    "Resource": [
        "*"
    ]
},
{
    "Effect": "Allow",
    "Action": [
        "cloudwatch:ListDashboards",
    ],
    "Resource": [
        "*" 
    ]
}
```

## Permissions that are granted to people who you share the dashboard with


When you share a dashboard, CloudWatch creates an IAM role in the account which gives the following permissions to the people who you share the dashboard with:
+ `cloudwatch:GetInsightRuleReport`
+ `cloudwatch:GetMetricData`
+ `cloudwatch:DescribeAlarms`
+ `ec2:DescribeTags`

**Warning**  
All people who you share the dashboard with are granted these permissions for the account. If you share the dashboard publicly, then everyone who has the link to the dashboard has these permissions.  
The `cloudwatch:GetMetricData` and `ec2:DescribeTags` permissions cannot be scoped down to specific metrics or EC2 instances, so the people with access to the dashboard can query all CloudWatch metrics and the names and tags of all EC2 instances in the account.

When you share a dashboard, by default the permissions that CloudWatch creates restrict access to only the alarms and Contributor Insights rules that are on the dashboard when it is shared. If you add new alarms or Contributor Insights rules to the dashboard and want them to also be seen by the people who you shared the dashboard with, you must update the policy to allow these resources.

# Sharing a CloudWatch dashboard with specific users
Sharing one dashboard with specific users

Use the steps in this section to share a dashboard with as many as five email addresses that you choose.

**Note**  
By default, any CloudWatch Logs widgets on the dashboard are not visible to people who you share the dashboard with. For more information, see [Allowing people that you share with to see logs table widgets](cloudwatch-dashboard-sharing.md#share-cloudwatch-dashboard-logwidget).  
By default, any composite alarm widgets on the dashboard are not visible to people who you share the dashboard with. For more information, see [Allowing people that you share with to see composite alarms](cloudwatch-dashboard-sharing.md#share-cloudwatch-dashboard-composite-alarms).

**To share a dashboard with specific users**

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 your dashboard.

1. Choose **Actions**, **Share dashboard**.

1. Next to **Share your dashboard and require a username and password**, choose **Start sharing**.

1. Under **Add email addresses**, enter the email addresses that you want to share the dashboard with. You can include as many as five email addresses.

1. When you have all the email addresses entered, read the agreement and select the confirmation box. Then choose **Preview policy**.

1. Confirm that the resources that will be shared are what you want, and choose **Confirm and generate shareable link**.

1. On the next page, choose **Copy link to clipboard**. You can then paste this link into email and send it to the invited users. They automatically receive a separate email with their user name and a temporary password to use to connect to the dashboard.

# Sharing a CloudWatch dashboard publicly
Sharing a dashboard publicly

Follow the steps in this section to share a dashboard publicly. This can be useful to display the dashboard on a big screen in a team room, or embed it in a Wiki page.

**Important**  
Sharing a dashboard publicly makes it accessible to anyone who has the link, with no authentication. Do this only for dashboards that do not contain sensitive information.

**Note**  
By default, any CloudWatch Logs widgets on the dashboard are not visible to people who you share the dashboard with. For more information, see [Allowing people that you share with to see logs table widgets](cloudwatch-dashboard-sharing.md#share-cloudwatch-dashboard-logwidget).  
By default, any composite alarm widgets on the dashboard are not visible to people who you share the dashboard with. For more information, see [Allowing people that you share with to see composite alarms](cloudwatch-dashboard-sharing.md#share-cloudwatch-dashboard-composite-alarms).

**To share a dashboard publicly**

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 your dashboard.

1. Choose **Actions**, **Share dashboard**.

1. Next to **Share your dashboard publicly**, choose **Start sharing**.

1. Enter **Confirm** in the text box.

1. Read the agreement and select the confirmation box. Then choose **Preview policy**.

1. Confirm that the resources that will be shared are what you want, and choose **Confirm and generate shareable link**.

1. On the next page, choose **Copy link to clipboard**. You can then share this link. Anyone you share the link with can access the dashboard, without providing credentials.

# Sharing all CloudWatch dashboards in the account by using SSO
Sharing all dashboards using SSO

Use the steps in this section to share all the dashboards in your account with users by using single sign-on (SSO).

**Note**  
By default, any CloudWatch Logs widgets on the dashboard are not visible to people who you share the dashboard with. For more information, see [Allowing people that you share with to see logs table widgets](cloudwatch-dashboard-sharing.md#share-cloudwatch-dashboard-logwidget).  
By default, any composite alarm widgets on the dashboard are not visible to people who you share the dashboard with. For more information, see [Allowing people that you share with to see composite alarms](cloudwatch-dashboard-sharing.md#share-cloudwatch-dashboard-composite-alarms).

**To share your CloudWatch dashboards with users who are in an SSO provider's list**

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 your dashboard.

1. Choose **Actions**, **Share dashboard**.

1. Choose **Go to CloudWatch Settings**.

1. If the SSO provider that you want isn't listed in **Available SSO providers**, choose **Manage SSO providers** and follow the instructions in [Setting up SSO for CloudWatch dashboard sharing](share-cloudwatch-dashboards-setup-SSO.md).

   Then return to the CloudWatch console and refresh the browser. The SSO provider that you enabled should now appear in the list.

1. Choose the SSO provider that you want in the **Available SSO providers** list.

1. Choose **Save changes**.

# Setting up SSO for CloudWatch dashboard sharing
Setting up SSO

To set up dashboard sharing through a third-party single sign-on provider that supports SAML, follow these steps. 

**Important**  
We strongly recommend that you do not share dashboards using a non-SAML SSO provider. Doing so causes a risk of inadvertently allowing third parties to access your account's dashboards.

**To set up an SSO provider to enable dashboard sharing**

1. Integrate the SSO provider with Amazon Cognito. For more information, see [ Integrating Third-Party SAML Identity Providers with Amazon Cognito User Pools](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-integrating-3rd-party-saml-providers.html).

1. Download the metadata XML file from your SSO provider.

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

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

1. In the **Dashboard sharing** section, choose **Configure**.

1. Choose **Manage SSO providers**.

   This opens the Amazon Cognito console in the US East (N. Virginia) Region (us-east-1). If you don't see any **User Pools**, the Amazon Cognito console might have opened in a different Region. If so, change the Region to **US East (N. Virginia) us-east-1** and proceed with the next steps.

1. Choose the **CloudWatchDashboardSharing** pool.

1. In the navigation pane, choose **Social and external providers**.

1. Choose **Add identity provider**.

1. Choose **SAML**.

1. Enter a name for your SSO provider in **Provider name**.

1. Choose **Select file**, and select the metadata XML file that you downloaded in step 2.

1. Choose **Create provider**.

# Seeing how many of your CloudWatch dashboards are shared
Seeing how many of your dashboards are shared

You can use the CloudWatch console to see how many of your CloudWatch dashboards are currently being shared with others.

**To see how many of your dashboards are being shared**

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

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

1. The **Dashboard sharing** section displays how many dashboards are shared.

1. To see which dashboards are shared, choose ***number* dashboards shared** under **Username and password** and under **Public dashboards.**

# Seeing which of your CloudWatch dashboards are shared
Seeing which dashboards are shared

You can use the CloudWatch console to see which of your dashboards are currently being shared with others.

**To see which of your dashboards are being shared**

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. In the list of dashboards, see the **Share** column. Dashboards that have the icon in this column filled in are currently being shared.

1. To see which users a dashboard is being shared with, choose the dashboard name, and then choose **Actions**, **Share dashboard**.

   The **Share dashboard *dashboard name*** page displays how the dashboard is being shared. If you want, you can stop sharing the dashboard by choosing **Stop sharing**.

# Stopping sharing one or more CloudWatch dashboards
Stopping dashboard sharing

You can stop sharing a single shared dashboard, or stop sharing all shared dashboards at once.

**To stop sharing a single 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 shared dashboard.

1. Choose **Actions**, **Share dashboard**.

1. Choose **Stop sharing**.

1. In the confirmation box, choose **Stop sharing**.

**To stop sharing all shared dashboards**

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

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

1. In the **Dashboard sharing** section, choose **Stop sharing all dashboards**.

1. In the confirmation box, choose **Stop sharing all dashboards**.

# Reviewing shared CloudWatch dashboard permissions and changing permission scope
Reviewing and changing shared dashboard permissions

Use the steps in this section if you want to review the permissions of the users of your shared dashboards, or change the scope of shared dashboard permissions.

**To review shared dashboard permissions**

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 shared dashboard.

1. Choose **Actions**, **Share dashboard**.

1. Under **Resources**, choose **IAM Role**.

1. In the IAM console, choose the displayed policy.

1. (Optional) To limit which alarms that shared dashboard users can see, choose **Edit policy** and move the `cloudwatch:DescribeAlarms` permission from its current position to a new `Allow` statement that lists the ARNs of only the alarms that you want to be seen by shared dashboard users. See the following example.

   ```
   {
      "Effect": "Allow",
       "Action": "cloudwatch:DescribeAlarms",
       "Resource": [
           "AlarmARN1",
           "AlarmARN2"
       ]
   }
   ```

   If you do this, be sure to remove the `cloudwatch:DescribeAlarms` permission from a section of the current policy that looks like this:

   ```
   { 
      "Effect": "Allow",
       "Action": [
           "cloudwatch:GetInsightRuleReport",
           "cloudwatch:GetMetricData",
           "cloudwatch:DescribeAlarms",
           "ec2:DescribeTags"
       ],
       "Resource": "*"
   }
   ```

1. (Optional) To limit the scope of what Contributor Insights rules that shared dashboard users can see, choose **Edit policy** and move the `cloudwatch:GetInsightRuleReport` from its current position to a new `Allow` statement that lists the ARNs of only the Contributor Insights rules that you want to be seen by shared dashboard users. See the following example.

   ```
   {
      "Effect": "Allow",
       "Action": "cloudwatch:GetInsightRuleReport",
       "Resource": [
           "PublicContributorInsightsRuleARN1",
           "PublicContributorInsightsRuleARN2"
       ]
   }
   ```

   If you do this, be sure to remove `cloudwatch:GetInsightRuleReport` from a section of the current policy that looks like this:

   ```
   {
               "Effect": "Allow",
               "Action": [
                   "cloudwatch:GetInsightRuleReport",
                   "cloudwatch:GetMetricData",
                   "cloudwatch:DescribeAlarms",
                   "ec2:DescribeTags"
               ],
               "Resource": "*"
           }
   ```

## Allowing people that you share with to see composite alarms


When you share a dashboard, by default the composite alarm widgets on the dashboard are not visible to the people who you share the dashboard with. For composite alarm widgets to be visible, you need to add a `DescribeAlarms: *` permission to the dashboard sharing policy. That permission would look like this:

```
{
    "Effect": "Allow",
    "Action": "cloudwatch:DescribeAlarms",
    "Resource": "*"
}
```

**Warning**  
The preceding policy statement give access to all alarms in the account. To reduce the scope of `cloudwatch:DescribeAlarms`, you must use a `Deny` statement. You can add a `Deny` statement to the policy and specify the ARNs of the alarms that you want to lock down. That deny statement should look similar to the following:  

```
{
    "Effect": "Allow",
    "Action": "cloudwatch:DescribeAlarms",
    "Resource": "*"
},
{   
    "Effect": "Deny",
    "Action": "cloudwatch:DescribeAlarms",
    "Resource": [
        "SensitiveAlarm1ARN",
        "SensitiveAlarm1ARN"
    ]
}
```

## Allowing people that you share with to see logs table widgets


When you share a dashboard, by default the CloudWatch Logs Insights widgets that are on the dashboard are not visible to the people who you share the dashboard with. This affects both CloudWatch Logs Insights widgets that exist now and any that are added to the dashboard after you share it.

If you want these people to be able to see CloudWatch Logs widgets, you must add permissions to the IAM role for dashboard sharing. 

**To allow the people that you share a dashboard with to see the CloudWatch Logs widgets**

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 shared dashboard.

1. Choose **Actions**, **Share dashboard**.

1. Under **Resources**, choose **IAM Role**.

1. In the IAM console, choose the displayed policy. 

1. Choose **Edit policy** and add the following statement. In the new statement, we recommend that you specify the ARNs of only the log groups that you want shared. See the following example.

   ```
   {
               "Effect": "Allow",
               "Action": [
                   "logs:FilterLogEvents",
                   "logs:StartQuery",
                   "logs:StopQuery",
                   "logs:GetLogRecord",
                   "logs:GetQueryResults",
                   "logs:DescribeLogGroups"
               ],
               "Resource": [
                   "SharedLogGroup1ARN",
                   "SharedLogGroup2ARN"
              ]
           },
   ```

1. Choose **Save Changes**.

If your IAM policy for dashboard sharing already includes those five permissions with `*` as the resource, we strongly recommend that you change the policy and specify only the ARNs of the log groups that you want shared. For example, if your `Resource` section for these permissions was the following:

```
"Resource": "*"
```

Change the policy to specify only the ARNs of the log groups that you want shared, as in the following example:

```
"Resource": [
  "SharedLogGroup1ARN",
  "SharedLogGroup2ARN"
]
```

## Allowing people that you share with to see custom widgets


When you share a dashboard, by default the custom widgets that are on the dashboard are not visible to the people who you share the dashboard with. This affects both custom widgets that exist now and any that are added to the dashboard after you share it.

If you want these people to be able to see custom widgets, you must add permissions to the IAM role for dashboard sharing. 

**To allow the people that you share a dashboard with to see the custom widgets**

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 shared dashboard.

1. Choose **Actions**, **Share dashboard**.

1. Under **Resources**, choose **IAM Role**.

1. In the IAM console, choose the displayed policy. 

1. Choose **Edit policy** and add the following statement. In the new statement, we recommend that you specify the ARNs of only the Lambda functions that you want shared. See the following example.

   ```
   {
     "Sid": "Invoke",
     "Effect": "Allow",
     "Action": [
         "lambda:InvokeFunction"
     ],
     "Resource": [
       "LambdaFunction1ARN",
       "LambdaFunction2ARN"
     ]
    }
   ```

1. Choose **Save Changes**.

If your IAM policy for dashboard sharing already includes that permission with `*` as the resource, we strongly recommend that you change the policy and specify only the ARNs of the Lambda functions that you want shared. For example, if your `Resource` section for these permissions was the following:

```
"Resource": "*"
```

Change the policy to specify only the ARNs of the custom widgets that you want shared, as in the following example:

```
"Resource": [
  "LambdaFunction1ARN",
  "LambdaFunction2ARN"
]
```

# Using live data in CloudWatch dashboards
Using live data

You can choose whether your metric widgets display *live data*. Live data is data published within the last minute that has not been fully aggregated.
+ If live data is turned **off**, only data points with an aggregation period of at least one minute in the past are shown. For example, when using 5-minute periods, the data point for 12:35 would be aggregated from 12:35 to 12:40, and displayed at 12:41.
+ If live data is turned **on**, the most recent data point is shown as soon as any data is published in the corresponding aggregation interval. Each time you refresh the display, the most recent data point may change as new data within that aggregation period is published. If you use a cumulative statistic such as **Sum** or **Sample Count**, using live data may result in a dip at the end of your graph.

You can choose to enable live data for a whole dashboard, or for individual widgets on the dashboard.

# Using live data for a CloudWatch dashboard
Using live data for a dashboard

**To choose whether to use live data on your entire 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. To permanently turn live data on or off for all widgets on the dashboard, do the following:

   1. Choose **Actions**, **Settings**, **Bulk update live data.**

   1. Choose **Live Data on** or **Live Data off**, and choose **Set**.

1. To temporarily override the live data settings of each widget, choose **Actions**. Then, under **Overrides**, next to **Live data**, do one of the following:
   + Choose **On** to temporarily turn on live data for all widgets. 
   + Choose **Off** to temporarily turn off live data for all widgets.
   + Choose **Do not override** to preserve each widget's live data setting.

# Using live data for a CloudWatch dashboard widget
Using live data for a widget

**To choose whether to use live data on a single widget**

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 a widget, and choose **Actions**, **Edit**.

1. Choose the **Graph options** tab.

1. Select or clear the check box under **Live Data**.

# Viewing an animated CloudWatch dashboard
Viewing an animated dashboard

You can view an animated dashboard that replays CloudWatch metric data that was captured over time. This can help you see trends, make presentations, or analyze issues after they occur.

Animated widgets in the dashboard include line widgets, stacked area widgets, number widgets, and metrics explorer widgets. Pie graphs, bar charts, text widgets, and logs widgets are displayed in the dashboard but are not animated.

**To view an animated 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.

1. Choose **Actions**, **Replay dashboard**.

1. (Optional) By default, when you start the animation, it appears as a sliding window. If you want the animation to appear as a point-by-point animation instead, choose the magnifying glass icon while the animation is paused and reset the zoom. 

1. To start the animation, choose the Play button. You can also choose the back and forward buttons to move to other points in time.

1. (Optional) To change the time window for the animation, choose the calendar and select the time period.

1. To change the speed of the animation, choose **Auto speed** and select the new speed.

1. When you are finished, choose **Exit animate**.

# Adding a CloudWatch dashboard to your favorites list
Add a dashboard to your favorites list

 In the CloudWatch console, you can add dashboards, alarms, and log groups to a favorites list. You can access the favorites list from the navigation pane. The following procedure describes how to add a dashboard to the favorites list. 

**To add a dashboard to the favorites list**

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.  From the list of dashboards, select the star symbol next to the name of the dashboard that you want to favorite. 

   1.  (Optional) You also can favorite a dashboard by selecting a dashboard from the list and choosing the star symbol next to the dashboard name. 

1.  To access the favorites list, choose **Favorites and recents** in the navigation pane. The menu contains two columns. One contains your favorite dashboards, alarms, and log groups, and the other column contains the dashboards, alarms, and log groups that you recently visited. 

**Tip**  
 You can favorite dashboards, as well as alarms and log groups, from the ***Favorites and recents*** menu in the CloudWatch console navigation pane. Under the ***Recently visited*** column, hover over the dashboard that you want to favorite, and choose the star symbol next to it. 

# Changing the period override setting or refresh interval for the CloudWatch dashboard
Changing the period override setting or refresh interval

You can specify how the period setting of graphs added to this dashboard are retained or modified.

When an auto period or persisted time range is applied to a widget, the overall time range of the graph can affect the periods that you have set.
+ If the time range is one day or less, period settings are not changed.
+ If the time range is between one day and three days, periods set to below five minutes are changed to 5 minutes.
+ If the time range is more than three days, periods set to below one hour are changed to one hour.

The following steps explain how to use the console to change the period override options. You can also change them by using the `periodOverride` field in the JSON structure of the dashboard. For more information, see [ Dashboard Body Overall Structure](https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/CloudWatch-Dashboard-Body-Structure.html#Dashboard-Body-Overall-Structure).

**To change the period override options**

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

1. Choose **Actions**.

1. Under **Period override**, choose one of the following:
   + Choose **Auto** to have the period of the metrics on each graph automatically adapt to the dashboard's time range.
   + Choose **Do not override** to ensure that the period setting of each graph is always obeyed.
   + Choose one of the other options to cause graphs added to the dashboard to always adapt that chosen time as their period setting.

   The **Period override** always reverts to **Auto** when the dashboard is closed or the browser is refreshed. Different settings for **Period override** can't be saved.

You can change how often the data on your CloudWatch dashboard is refreshed.

**To change the dashboard refresh interval**

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. On the **Refresh options** menu (upper-right corner), choose **10 Seconds**, **1 Minute**, **2 Minutes**, **5 Minutes**, or **15 Minutes**.

# Changing the time range or time zone format of a CloudWatch dashboard
Changing the time range or time zone format

You can change the time range to display dashboard data over minutes, hours, days, or weeks. You also can change the time zone format to display dashboard data in UTC or local time. Local time is the time zone that's specified in your computer's operating system. 

**Note**  
If you create a dashboard with graphs that contain 100 or more high-resolution metrics, we recommend that you don't set the time range to longer than 1 hour. For more information, see [High-resolution metrics](publishingMetrics.md#high-resolution-metrics). 

**Note**  
If the time range of a dashboard is shorter than the period used for a widget on the dashboard, the following happens:  
 The widget is modified to display the amount of data corresponding one complete period for that widget, even though this is longer than the dashboard time range. This ensures that there is at least one data point on the graph. 
 The start time of the period for this data point is adjusted backwards to ensure that at least one data point can be displayed.

------
#### [ New console ]

**To change the dashboard time range**

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, do one of the following: 
   + In the upper area of the dashboard, select one of the predefined time ranges. These span from 1 hour to 1 week (**1h**, **3h**, **12h**, **1d**, or **1w**).
   + Alternatively, you can choose one of the following custom time range options:
     + Choose **Custom**, and then choose the **Relative** tab. Choose a time range from 1 minute to 15 months. 
     + Choose **Custom**, and then choose the **Absolute** tab. Use the calendar or text fields to specify your time range. 

**Tip**  
If the aggregation period is set to **Auto** when you change the time range of a graph, CloudWatch might change the period. To set the period manually, choose the **Actions** dropdown, and then choose **Period override**. 

**To change the dashboard time zone format**

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 area of the dashboard, choose **Custom**.

1. In the upper-right corner of the box that appears, select **UTC** or **Local time** from the dropdown. 

1.  Choose **Apply**. 

------
#### [ Old console ]

**To change the dashboard time range**

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, do one of the following: 
   + In the upper area of the dashboard, select one of the predefined time ranges. These span from 1 hour to 1 week (**1h**, **3h**, **12h**, **1d**, **3d**, or **1w**).
   + Alternatively, you can choose one of the following custom time range options:
     + Choose the **custom** dropdown, and then choose the **Relative** tab. Select one of the predefined ranges, which span from 1 minute to 15 months. 
     + Choose the **custom** dropdown, and then choose the **Absolute** tab. Use the calendar or text fields to specify your time range. 

**Tip**  
If the aggregation period is set to **Auto** when you change the time range of a graph, CloudWatch might change the period. To set the period manually, choose the **Actions** dropdown, and then choose **Period override**. 

**To change the dashboard time zone format**

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 dashboard screen, choose the **Custom** dropdown.

1. In the upper-right corner of the box that appears, select **UTC** or **Local timezone** from the dropdown.

------