I'm trying to setup a Dashboard in Cloudformation and want to use an Exported Value to make it dynamic: but it fails saying:
The dashboard body is invalid, there are 1 validation errors: [ { "message": "Invalid metric field type, only \"String\" type is allowed", "dataPath": "/widgets/0/properties/metrics/0/3" } ] (Service: AmazonCloudWatch; Status Code: 400; Error Code: InvalidParameterInput; Request ID: 01f3ebfa-d856-11e8-a2dc-dd8c90ad1109)
the code is:
Resources:
NATDashboard:
Type: AWS::CloudWatch::Dashboard
Properties:
DashboardName: NAT-Dashboard
DashboardBody: !Sub |
{
"widgets": [
{
"type": "metric",
"x": 0,
"y": 0,
"width": 3,
"height": 9,
"properties": {
"metrics": [
[ "AWS/NATGateway", "ActiveConnectionCount", "NatGatewayId", {"Fn::ImportValue": {"Fn::Sub": "${EnvironmentName}-NATGateway1Id"}}, { "stat": "Maximum" } ],
[ "...", "nat-057236a417c993781", { "stat": "Maximum" } ],
[ "...", "nat-09b8d012addc7e0fe", { "stat": "Maximum" } ]
],
"view": "singleValue",
"region": "${AWS::Region}"
}
},
it works until I introduce Fn::ImportValue; is there a chance to use Exported Values here?
Merci A