title: AWS lambda - Release /tmp storage after each execution
body: <p>I have 4 lambda functions which will be invoked at same time (by SNS), the frequence of SNS's event is 5 minutes.
  Each function process the large mount of data and images(~300MB) so I store them on <code>/tmp</code> folder (500MB limit).</p>
  
  <p>At the beginning of  function, I wrote some code to the clean up <code>/tmp</code> folder, to make sure it's not out of memory (Because I've known that AWS lambda sometimes reuses previous container to improve performance).</p>
  
  <p>I check it manually (create message and publish by SNS to 4 lambda functions), it worked fine.</p>
  
  <p>But when it runs automatically (invoked each 5 minutes) the result is not as my expectation. The first execution is fine, but the next times after, 1 of 4 or even 4 lambda functions throw out the error related to "out of memory": "No space left on device", cannot load lib, ...</p>
  
  <p>Previous, I use nodejs(4.3) it worked fine both case.</p>
  
  <p>But I have to change to python for some reason, the main flow and the mount of created data is the same. But it's failed when run automatically.</p>
  
  <p>I think that the issue came from the cache of previous container (reused container), I checked the <code>/tmp</code> after clean (<code>ls -alh /tmp</code>) there's no files but when check the storage (<code>df /tmp</code>) it show that used is 77%.</p>
  
  <p>Any suggestion to make clean <code>/tmp</code> folder or work around solution is very appreciate. Thank!</p>
  
  <p>Edited: Code I use to clean <code>/tmp</code> folder:</p>
  
  <pre><code>from subprocess import call
  ...
  call('rm -rf /tmp/*', shell=True)
  </code></pre>