Aws get-metric-statistic datapoint is null

1.4k Views Asked by At

I have been using aws cli to get metrics statistic, but when I run this command, datapoint is null, my command is:

aws cloudwatch get-metric-statistics --metric-name CPUUtilization --start-time 10:00:00 --end-time 10:05:00 --period 30 --namespace AWS/EC2 --statistics Maximum --dimensions Name=InstanceId,Value=i-0d6f3611e2685f0c8

and when I run the following command, data point is null Datapoint Null image , or is there any configuration needed before using get-metric-statistic?

1

There are 1 best solutions below

0
On

You need to specify start-time and end-time in ISO 8601 UTC format not just the time. Example: 2018-08-01T10:00:00Z.

Also, make sure you are specifying a proper period as described in the docs.

If the StartTime parameter specifies a time stamp that is greater than 3 hours ago, you must specify the period as follows or no data points in that time range is returned:

  • Start time between 3 hours and 15 days ago - Use a multiple of 60 seconds (1 minute).
  • Start time between 15 and 63 days ago - Use a multiple of 300 seconds (5 minutes).
  • Start time greater than 63 days ago - Use a multiple of 3600 seconds (1 hour).

You can change start time/end time to include the date you want. In your case the following command should work:

aws cloudwatch get-metric-statistics --metric-name CPUUtilization --start-time 2018-08-01T10:00:00Z --end-time 2018-08-01T10:05:00Z --period 60 --namespace AWS/EC2 --statistics Maximum --dimensions Name=InstanceId,Value=i-0d6f3611e2685f0c8