Getting always empty datapoints (i've checked old post on stackoverflow):
cwesponse = cw.get_metric_statistics(
Namespace='AWS/EC2',
MetricName='CPUUtilization',
Dimensions=[
{
'Name': 'InstanceId',
'Value': ec2i['InstanceId']
},
],
StartTime=datetime.datetime.utcnow() - datetime.timedelta(days=14),
EndTime=datetime.datetime.utcnow() ,
Period=900,
Statistics=['Average'],
Unit='Percent'
)
response:
{'Label': 'CPUUtilization', 'Datapoints': [], 'ResponseMetadata': {'RequestId': '0820b8e2-c301-41b2-b031-2eb61f9b4c92', 'HTTPStatusCode': 200, 'HTTPHeaders': {'x-amzn-requestid': '0820b8e2-c301-41b2-b031-2eb61f9b4c92', 'content-type': 'text/xml', 'content-length': '337', 'date': 'Mon, 20 Dec 2021 22:48:41 GMT'}, 'RetryAttempts': 0}}
the same parameters of date and period give me graph on console !