title: Extract zip file from S3 bucket with AWS Lambda function with Node.js and upload to another bucket
body: <p>Iam playing with <code>AWS Lambda</code> with <code>Node.js</code>. I have created a lambda function and configure it with <code>S3 event</code>.
  I want to extract zip file which is uploaded on S3 and upload extracted file to another folder on same bucket.</p>
  
  <p>I am getting the bucket and file information from following code but after that I don't know how to extract and upload to s3.</p>
  
  <p>Any suggestion or chunk of code will be helpful for me.</p>
  
  <pre><code>'use strict';
  
  console.log('Loading function to get all latest object from S3 service');
  
  const aws = require('aws-sdk');
  
  const s3 = new aws.S3({ apiVersion: '2006-03-01' });
  
  
  exports.handler = (event, context, callback) =&gt; {
      console.log('Received event:', JSON.stringify(event, null, 2));
  
      // Get the object from the event and show its content type
      const bucket = event.Records[0].s3.bucket.name;
      const key = decodeURIComponent(event.Records[0].s3.object.key.replace(/\+/g, ' '));
      const params = {
          Bucket: bucket,
          Key: key,
      };
      s3.getObject(params, (err, data) =&gt; {
          if (err) {
              console.log(err);
              const message = `Error getting object ${key} from bucket ${bucket}. Make sure they exist and your bucket is in the same region as this function.`;
              console.log(message);
              callback(message);
          } else {
              console.log('CONTENT TYPE:', data.ContentType);
              callback(null, data);
          }
      });
  };
  </code></pre>