Why isn't my CloudWatch GetMetricStatistics API call returning data points? 

Last updated: 2022-08-24

My Amazon CloudWatch "GetMetricStatistics" API call isn't returning any data points. However, the data points are available on the CloudWatch console. How can I resolve this?


Note: If you receive errors when running AWS Command Line Interface (AWS CLI) commands, make sure that you’re using the most recent AWS CLI version.

CloudWatch is a Regional service, so make sure that the API call uses the correct Region. The GetMetricStatistics API call is issued with multiple arguments, and those arguments must match the properties of the metric. These arguments are case-sensitive, so you must be sure that the names and cases match in the CloudWatch console configuration. Most often, errors are caused by incorrect arguments.


If the metric is created with multiple dimensions, then the data points for that metric can be retrieved only by specifying all the configured dimensions. For example, suppose you publish a metric named ServerStats in the DataCenterMetric namespace with these properties:

Dimensions: Server=Prod, Domain=Frankfurt, Unit: Count, Timestamp: 2016-10-31T12:30:00Z, Value: 105

You can retrieve data points for this metric by specifying these dimensions:


However, you can't retrieve the data points if you specify just one of the two dimensions. For example:


With the AWS CLI, the format for specifying dimensions in the get-metric-statistics command is different from the put-metric-data command. Be sure to use a format similar to the following:

"Name"=string, "Value"=string

instead of this format:


Example of the get-metric-statistics call:

aws cloudwatch get-metric-statistics --metric-name "MyMetric" --start-time 2018-04-08T23:18:00Z --end-time 2018-04-09T23:18:00Z --period 3600 --namespace "MyNamespace" --statistics Maximum --dimensions Name=Server,Value=Prod

Example of the put-metric-data call:

aws cloudwatch put-metric-data --namespace "MyNamespace" --metric-name "MyMetric" --dimensions Server=Prod --value 10


If the metric isn't pushed for the specified period value, then no data points are returned.

For example, if you activate basic monitoring for an instance, then Amazon Elastic Compute Cloud (Amazon EC2) pushes data points every five minutes. For example, suppose that Amazon EC2 pushes the data points at time stamps 12:00, 12:05, 12:10, and so on. If the start time and end time within 12:01 and 12:04, and then you try to retrieve the data points with a period of 60 seconds, you won't see any data points. It's a best practice to have your start time and end time extend beyond the minimum granularity offered by the metric (5 minutes in this case). Or, use a period that is greater than or equal to the minimum granularity offered by the metric.


To retrieve percentile statistics for a metric, use ExtendedStatistic.

CloudWatch uses raw data points to calculate percentiles. When you publish data using a statistic set, you can retrieve percentile statistics for this data only if one of the following conditions are true:

  • The SampleCount of the statistic set is 1.
  • The Min and the Max of the statistic set are equal.


  • If the specified unit is different from the one that's configured for the metric, then no data points are returned.
  • If you don't specify the unit argument, then data points for all units are returned.

Start time and end time

  • Format the start time and the end time arguments as specified in the GetMetricStatistics documentation.
  • If no data points are pushed for the metric between the start time and end time, then no data points are returned.

Note: Data points with time stamps from 24 hours ago or longer can take at least 48 hours to become available for get-metric-statistics. For more information, see put-metric-data.

Did this article help?

Do you need billing or technical support?