title: Create a custom cloudwatch metric that calculates the %
body: <p>I have a custom metric in cloudwatch that counts how many files have been uploaded to an S3 bucket. I want to get alarmed when the number of the  uploaded files has exceeded some threshold that will be calculated in %. 
  I have been thinking and I think I'll need to calculate for each value a percentage value : </p>
  
  <p><strong><em>Example</strong> :</em></p>
  
  <p>at 8h: I have 80 files uploaded.</p>
  
  <p>The maximum number of files that can be uploaded at a time is defined to be 200 files</p>
  
  <p>so the percentage for the value of 80 is : <code>p = 80*100/200 = 40%</code></p>
  
  <p>So I need to <strong>create a custom metric that calculates the percentage of each value</strong> and get me notified by an alarm when the percentage is higher than 80%</p>
  
  <p>Any idea how to do this calculation ?</p>
  
  <p>Below the graph of the uploaded files</p>
  
  <p><a href="https://i.stack.imgur.com/6h1bH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6h1bH.png" alt="graph"></a></p>