I'm attempting to use an expression: Search in my CloudFormation in making a Dashboard.
{ "expression": "SEARCH('{AWS/ApiGateway,ApiName} MetricName=\"Count\"', 'Sum', 300)", "id": "e1" }
The line above is taken directly from the Cloudwatch source when creating a widget. This has to be modified for CloudFormation since Dashboard in CloudFormation is type string.
What I've altered it to looks like::
{ \"expression\": \"SEARCH('{AWS/ApiGateway,ApiName} MetricName=\"Count\"', 'Sum', 300)\", \"id\": \"e1\" }
The problem is that when I attempt to update CloudFormation with this change, it fails.
I've tried using documentation but AWS doesn't have anything for this type of problem and I can't seem to find proper resources to show how it should be done.
Any help would be great, Thanks.
-edit-
Here is a snippet of my template:
As for template I can give you snippets:
\"properties\":
{
\"metrics\":
[
{ \"expression\": \"SEARCH('{AWS/ApiGateway,ApiName} MetricName=\"Count\"', 'Sum', 300)\", \"id\": \"e1\" }
],
\"period\": 300,
\"stat\": \"Average\",
\"region\": \"$${AWS::Region}\"
}
I can tell everyone that the expression itself is the problem. If I were to remove that expression all together and save/update my template CloudFormation will update and push but the expression itself causes an error, probably because of the formatting.
-edit #2-
So I've been working on this and got some new info and a new error but I think it's a step forward.
{ \"expression\": \"SEARCH('{AWS/ApiGateway,ApiName} MetricName=\\\"Count\\\"', 'Sum', 300)\", \"id\": \"e1\" }
One of the devs at my work gave me this change to the code, thought that it would work but got this error with it.
The dashboard body is invalid, there are 2 validation errors:
[
{ "dataPath": "/widgets/4/properties/metrics/0", "message": "Should be array" },
{ "dataPath": "/widgets/4/properties/metrics/0", "message": "Field \"metrics\" has to be an array of array of strings, with an optional metricRenderer object as last element" }
]
(Service: AmazonCloudWatch; Status Code: 400; Error Code: