title: Step timed out while step is verifying the SSM Agent availability on the target instance(s). SSM Agent on Instances: [i-xxxxxxx] are not functioning
body: <p>I am working on &quot;Patch an AMI and update an Auto Scaling group&quot; and followed the AWS <a href="https://docs.aws.amazon.com/systems-manager/latest/userguide/automation-walk-patch-windows-ami-autoscaling.html" rel="nofollow noreferrer">document</a> to configure but I am stuck at &quot;Task 3: Create a runbook, patch the AMI, and update the Auto Scaling group&quot; with the below error. To fix it I have added &quot;user data&quot; while starting the instance(<code>startInstances</code>). As it's accepting only base64, converted and provided base64(UmVzdGFydC1TZXJ2aWNlIEFtYXpvblNTTUFnZW50Cg==).</p>
  <p>I tried to execute with the below user data but both are not working, even I tried to apply a new step with the same commands but failed to patch AMI.</p>
  <ol>
  <li><p>Tried the below script:</p>
  <p><code>&lt;powershell&gt; powershell.exe -Command Start-Service -Name AmazonSSMAgent &lt;/powershell&gt; &lt;persist&gt;true&lt;/persist&gt;</code></p>
  </li>
  <li><p>Tried to start and restart SSM agent.</p>
  <pre><code>Restart-Service AmazonSSMAgent
  </code></pre>
  <p>base64: <code>UmVzdGFydC1TZXJ2aWNlIEFtYXpvblNTTUFnZW50Cg==</code></p>
  </li>
  </ol>
  <p>YAML sample:</p>
  <pre><code>mainSteps:
    - name: startInstances
      action: 'aws:runInstances'
      timeoutSeconds: 1200
      maxAttempts: 1
      onFailure: Abort
      inputs:
        ImageId: '{{ sourceAMIid }}'
        InstanceType: m3.large
        MinInstanceCount: 1
        MaxInstanceCount: 1
        SubnetId: '{{ subnetId }}'
        UserData: UmVzdGFydC1TZXJ2aWNlIEFtYXpvblNTTUFnZW50Cg==
  </code></pre>
  <p>Still, I am seeing the below error.</p>
  <pre><code>Step timed out while step is verifying the SSM Agent availability on the target instance(s). SSM Agent on Instances: [i-xxxxxxxx] are not functioning. Please refer to Automation Service Troubleshooting Guide for more diagnosis details.
  </code></pre>
  <p>Your suggestion/solutions help me a lot. Thank you.</p>