title: AWS Lambda can't delete Amazon S3 object
body: <p>I'm trying to create an AWS Lambda function, which processes a file uploaded to the first bucket, then saves it to the second bucket and then deletes the input file.</p>
  
  <p>The problem is that when I'm trying to delete the file I'm getting
  </p>
  
  <pre class="lang-js prettyprint-override"><code>{
    "message": "Access Denied",
    "code": "AccessDenied",
    "time": "2015-02-09T22:08:45.926Z",
    "statusCode": 403,
    "retryable": false,
    "retryDelay": 30
  }
  </code></pre>
  
  <p>The code snippet, which tries to delete the file is</p>
  
  <pre class="lang-js prettyprint-override"><code>s3.deleteObject({
      Bucket: inputBucket,
      Key: inputKey
  }, function(a, b) {
      if (a) {
          console.error("Error on delete");
          console.error(a);
      } else {
          console.log("Deleted successfully");
      }
  });
  </code></pre>