title: How to use Parameters in CloudWatch Dashboard template
body: <p>I am trying to create a <code>CloudFormation</code> template to create a <code>CloudWatch</code> dashboard. Following is the template code -</p>
  
  <pre><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: &gt;
                  {
                      "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"
                                      ]...
  </code></pre>
  
  <p>I am trying to use <code>MyEnvironment</code> parameter which will be provided when I will actually use this template to create a stack.</p>
  
  <p>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 <code>"${MyEnvironment}-my-data-out"</code> instead of <code>"Dev-my-data-out"</code> assuming I have provided <code>"MyEnvironment"</code> value as <code>"Dev"</code></p>
  
  <p>I tried the method specified in this link - <a href="https://stackoverflow.com/questions/52878042/use-pseudo-variables-in-cloudwatch-dashboard-template-cloudformation">Use Pseudo Variables in Cloudwatch Dashboard Template (Cloudformation)</a> but CloudFormation shows invalid template when using <code>Sub &gt;-</code> keyword.</p>