title: AWS Cloudformation YML File with Embedded JSON Strong for Dashboard Body
body: <p>Trying to make our dashboard as code while using CloudFormation.  Getting an error while validating template with the embedded JSON String inside the YML File. It is having problems with the "SEARCH('{AWS/EC2,InstanceId) fields saying those are invalid strings.  I have ran it through a JSON Linter and works fine. I have also deployed the CloudWatch Dashboard console just fine with the JSON.  </p>
  
  <p><strong>Question:</strong> </p>
  
  <p>Is there anyway to just wrap this section as a string for CloudFormation in the YML file so it doesn't get tripped up on the JSON string contents? </p>
  
  <p><strong>Example:</strong> </p>
  
  <pre><code> DetailedDashboard:
      Type: "AWS::CloudWatch::Dashboard"
      Properties:
        DashboardName: "DetailedDashboard"
        DashboardBody: !Sub
        ...,
                    {
                         "type": "metric",
                         "x": 6,
                         "y": 18,
                         "width": 6,
                         "height": 6,
                         "properties": {
                             "metrics": [
                                 [ { "expression": "SEARCH('{AWS/EC2,InstanceId} NetworkIn', 'Average', 300)", "id": "network_in", "period": 300, "region": "us-east-1", "label": "net_in" } ],
                                 [ { "expression": "SEARCH('{AWS/EC2,InstanceId} NetworkOut', 'Average', 300)", "id": "network_out", "period": 300, "region": "us-east-1", "label": "net_out" } ]
                              ],
                          "view": "timeSeries",
                          "stacked": false,
                          "region": "us-east-1",
                          "title": "Network in/out by Host",
                          "stat": "Average",
                          "period": 300,
                          "yAxis": {
                            "left": {
                              "label": "bytes"
                            }
                          }
                        }
                        },
  </code></pre>