title: Streaming file from URI directly to S3 using lambda using ridiculous amount of memory
body: <p>I was able to stream files directly from a URI to S3 without downloading it on disk with AWS Lambda (node.js) using <a href="https://gist.github.com/sevastos/5804803" rel="nofollow">this guys sample code</a>. I modified it a bit so I could create a buffer from a request object body. <a href="https://gist.github.com/maxKimoby/b19495a0a3af522a5076" rel="nofollow">This is my code</a>.</p>
  
  <p>It works wonder except for a very important thing! The files are maximum 350 MB, but every time the lambda function run, it takes up to 1.5 GB memory and even more! The maximum allowed memory for a function call is 1.536 GB. The amount normally used is between 0.8 GB to 1.5 GB (it is pretty random).</p>
  
  <p>I think there is a memory leak somewhere, but I can't figure out where!</p>
  
  <p>Any ideas?</p>