title: How to upload multiple images at a time in s3 bucket using Node JS (Express)
body: <pre><code>require(&quot;dotenv&quot;).config();
  const AWS = require(&quot;aws-sdk&quot;);
  const multer = require(&quot;multer&quot;);
  const multerS3 = require(&quot;multer-s3&quot;);
  const uuid = require(&quot;uuid&quot;).v4;
  const path = require(&quot;path&quot;);
  
  const s3 = new AWS.S3({
    accessKeyId: process.env.AWS_S3_ACCESS_KEY_ID,
    secretAccessKey: process.env.AWS_S3_SECRET_ACCESS_KEY
  });
  
  const upload = multer({
    storage: multerS3({
      s3: s3,
      Bucket: process.env.AWS_S3_BUCKET_NAME,
      ACL: &quot;public-read&quot;,
      metadata: (req, file, cd) =&gt; {
        cd(null, { fieldName: file.fieldname });
      },
      key: (req, file, cb) =&gt; {
        const ext = path.extname(file.originalname);
        const uniqueName = `${uuid()}${ext}`;
        cb(null, uniqueName);
      },
    }),
  });
  
  module.exports = {
      upload
  } 
  router.post(&quot;/photo-upload&quot;, upload.array('photos'), (req, res) =&gt; {  
      return res.status(200).send({
        success: true,
        result: 'Images Uploaded',
      });
    });
  </code></pre>
  <p>After adding this code my code is crashing and getting below errors
  **node_modules/multer-s3/index.js:94
  case 'undefined': throw new Error('bucket is required')</p>
  <p>Error: bucket is required
  at new S3Storage**</p>
  <p>is there any way to upload multiple file at a time not using loop.
  Body: buffer, can I send it as a [buffer, buffer]?</p>