title: How to upload an object into S3 in Lambda?
body: <p>Can't seem to upload an object into S3 in Lambda. Everything works fine locally. No errors in logs that would show what's going wrong...</p>
  
  <p>Code below:</p>
  
  <pre><code>console.log('Loading function');
  var AWS = require('aws-sdk');
  var s3 = new AWS.S3();
  
  exports.handler = function(event, context) {
      //console.log(JSON.stringify(event, null, 2));
      var s3 = new AWS.S3();
      var param = {Bucket: 'flow-logs', Key: 'test-lambda-x', Body: 'me me me'};
      console.log("s3");
      s3.upload(param, function(err, data) {
          if (err) console.log(err, err.stack); // an error occurred
          else console.log(data);           // successful response
      });
      console.log('done');
      context.done();
  };
  </code></pre>
  
  <p>Runs successfully w/o error, but the callback in s3.upload doesn't seem to be called. No object in bucket is created.</p>
  
  <p>Verified IAM role permissions weren't a problem by granting full access, as well as testing out locally.</p>
  
  <p>Output</p>
  
  <pre><code>START RequestId: d4847fdb-160c-11e5-8a8c-b555b123e14d
  2015-06-18T22:53:29.750Z    d4847fdb-160c-11e5-8a8c-b555b123e14d    s3
  2015-06-18T22:53:30.271Z    d4847fdb-160c-11e5-8a8c-b555b123e14d    done
  END RequestId: d4847fdb-160c-11e5-8a8c-b555b123e14d
  </code></pre>