I have a moderate collection of Lambda functions that have been developed over a period of several years and I'm attempting a clean up and rationalisation. As part of this, I am attempting to run some reports on the frequency of invocation and success of these functions over time. I would like to do this programmatically - initially from the command line and subsequently from a Python program. I'm calling "aws cloudwatch get-metric-statistics" with input from a json file :
"aws cloudwatch get-metric-statistics --cli-input-json file://get-stats.json"
where the input file is:
"{
"Namespace": "AWS/Lambda",
"MetricName": "Invocations",
"Dimensions": [
{
"Name": "FunctionName",
"Value": "serverWatchdog"
},
{
"Name": "Resource",
"Value": "serverWatchdog"
}
],
"StartTime": "2020-12-01T00:00:00",
"EndTime": "2020-12-05T00:00:00",
"Period": 360,
"Statistics": \[
"Average"
],
"Unit": "Count"
}"
I know that this function is being called several times per hour - I can see it on the Cloudwatch console. But my CLI command always returns:
{
"Label": "Invocations",
"Datapoints": []
}
Any suggestions as to what I'm doing wrong?
TIA
Martin