title: Write to S3 bucket using Async/Await in AWS Lambda
body: <p>I have been using the code below (which I have now added await to) to send files to S3. It has worked fine with my lambda code but as I move to transfer larger files like MP4 I feel I need async/await.</p>
  
  <p>How can I fully convert this to async/await?</p>
  
  <pre><code>exports.handler = async (event, context, callback) =&gt; {
  ...
  // Copy data to a variable to enable write to S3 Bucket
  var result = response.audioContent;
  console.log('Result contents ', result);
  
  // Set S3 bucket details and put MP3 file into S3 bucket from tmp
  var s3 = new AWS.S3();
  await var params = {
  Bucket: 'bucketname',
  Key: filename + ".txt",
  ACL: 'public-read',
  Body: result
  };
  
  await s3.putObject(params, function (err, result) {
  if (err) console.log('TXT file not sent to S3 - FAILED'); // an error occurred
  else console.log('TXT file sent to S3 - SUCCESS');    // successful response
  context.succeed('TXT file has been sent to S3');
  });
  </code></pre>