title: Unable to Create a CloudWatch Healthcheck via Ansible
body: <p>I have a inventory file which has a RDS endpoint as :</p>
  
  <pre><code>[ems_db]
  syd01-devops.ce4l9ofvbl4z.ap-southeast-2.rds.amazonaws.com
  </code></pre>
  
  <p>I wrote the following play book to create a Cloudwatch ALARM :</p>
  
  <pre><code>---
  
      - name: Get instance ec2 facts
        debug: var=groups.ems_db[0].split('.')[0]
        register: ems_db_name
  
      - name: Display
        debug: var=ems_db_name
  
      - name: Create CPU utilization metric alarm
        ec2_metric_alarm:
            state: present
            region: "{{aws_region}}"
            name: "{{ems_db_name}}-cpu-util"
            metric: "CPUUtilization"
            namespace: "AWS/RDS"
            statistic: Average
            comparison: "&gt;="
            unit: "Percent"
            period: 300
            description: "It will be triggered when CPU utilization is more than 80% for 5 minutes"
            dimensions: { 'DBInstanceIdentifier' : ems_db_name }
            alarm_actions: arn:aws:sns:ap-southeast-2:493552970418:cloudwatch_test
            ok_actions: arn:aws:sns:ap-southeast-2:493552970418:cloudwatch_test
  </code></pre>
  
  <p>But this results in </p>
  
  <pre><code>TASK: [cloudwatch | Get instance ec2 facts] *********************************** 
  ok: [127.0.0.1] =&gt; {
      "var": {
          "groups.ems_db[0].split('.')[0]": "syd01-devops"
      }
  }
  
  TASK: [cloudwatch | Display] ************************************************** 
  ok: [127.0.0.1] =&gt; {
      "var": {
          "ems_db_name": {
              "invocation": {
                  "module_args": "var=groups.ems_db[0].split('.')[0]", 
                  "module_complex_args": {}, 
                  "module_name": "debug"
              }, 
              "var": {
                  "groups.ems_db[0].split('.')[0]": "syd01-devops"
              }, 
              "verbose_always": true
          }
      }
  }
  
  TASK: [cloudwatch | Create CPU utilization metric alarm] ********************** 
  failed: [127.0.0.1] =&gt; {"failed": true}
  msg: BotoServerError: 400 Bad Request
  &lt;ErrorResponse xmlns="http://monitoring.amazonaws.com/doc/2010-08-01/"&gt;
    &lt;Error&gt;
      &lt;Type&gt;Sender&lt;/Type&gt;
      &lt;Code&gt;MalformedInput&lt;/Code&gt;
    &lt;/Error&gt;
    &lt;RequestId&gt;f30470a3-2d65-11e6-b7cb-cdbbbb30b60b&lt;/RequestId&gt;
  &lt;/ErrorResponse&gt;
  
  
  FATAL: all hosts have already failed -- aborting
  </code></pre>
  
  <p>What is wrong here? What can i do to solve this ? I am new to this but surely this seems some syntax issue with me or the way i am picking up the inventory endpoint split. </p>