title: How to avoid repeated OK/ALARM transitions for CloudWatch alarms?
body: <h2>How to reproduce</h2>
  
  <ol>
  <li><p>Create a Lambda function <code>myFunction</code> which succeeds:</p>
  
  <pre><code>def lambda_handler(event, context):
      return
  </code></pre></li>
  <li>Test the function at 10:55</li>
  <li>Go to CloudWatch → Metrics → Lambda → <code>myFunction</code> Errors</li>
  <li>Click "Create Alarm"</li>
  <li>Select ">", a <strong>period of 5 minutes</strong>, and remove the default notification action, resulting in a threshold of "Errors > 0 for 5 minutes"</li>
  <li>Save at 10:58</li>
  <li><p>Change the function to fail:</p>
  
  <pre><code>def lambda_handler(event, context):
      raise Exception()
  </code></pre></li>
  <li>Test <code>myFunction</code> at 10:59, resulting in an error count of 1 in the CloudWatch log for the function at that time</li>
  </ol>
  
  <h2>What happens in the alarm history after 10:59</h2>
  
  <ol>
  <li>State transition to "alarm" at 10:59</li>
  <li>State transition to "insufficient data" at <strong>11:15</strong></li>
  </ol>
  
  <h2>What I expect to happen</h2>
  
  <ol>
  <li>State transition to "alarm" at 10:59</li>
  <li>State transition to "insufficient data" at <strong>11:04</strong></li>
  </ol>
  
  <h2>Analysis</h2>
  
  <p>The state transition to "insufficient data" doesn't happen at 11:04. There's a <a href="https://stackoverflow.com/a/15277644/96588">known bug</a> saying it should happen at 11:09 (two periods), but instead it happens after more than three. Is the period until "insufficient data" even more arbitrary than expected?</p>