multer s3 delete file code example

Example: how to store and delete s3 image using node js

const s3 = new AWS.S3(
  {  accessKeyId: IAM_USER_KEY,  /* required */# Put your iam user key 
   secretAccessKey: IAM_USER_SECRET, /* required */  # Put your iam user secret key
   Bucket: BUCKET_NAME     /* required */     # Put your bucket name
  }
);

s3.deleteObject({
  Bucket: MY_BUCKET,
  Key: 'some/subfolders/nameofthefile1.extension'
},function (err,data){})

   s3.createBucket({
            Bucket: BUCKET_NAME        /* Put your bucket name */
        }, function () {
            s3.putObject(params, function (err, data) {});
        });