I am trying to create a CloudFormation
template to create a CloudWatch
dashboard. Following is the template code -
Parameters:
MyEnvironment:
Type: String
Default: "do"
Description: "Specifies the environment of the platform."
Resources:
MyServiceDashboard:
Type: AWS::CloudWatch::Dashboard
Properties:
DashboardName: "Test-My-Dashboard"
DashboardBody: >
{
"widgets": [
{
"type": "metric",
"x": 15,
"y": 18,
"width": 6,
"height": 6,
"properties": {
"view": "timeSeries",
"stacked": false,
"metrics": [
[ "AWS/Kinesis", "GetRecords.IteratorAgeMilliseconds", "StreamName",
"${MyEnvironment}-my-data-out"
]...
I am trying to use MyEnvironment
parameter which will be provided when I will actually use this template to create a stack.
Problem is stack/dashbaord gets created using this but the parameter value is not getting used in the Dashboard metric instead it uses value as "${MyEnvironment}-my-data-out"
instead of "Dev-my-data-out"
assuming I have provided "MyEnvironment"
value as "Dev"
I tried the method specified in this link - Use Pseudo Variables in Cloudwatch Dashboard Template (Cloudformation) but CloudFormation shows invalid template when using Sub >-
keyword.