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?
You need to specify
start-time
andend-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.
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