Contoh JavaScript AWS S3

const AWS = require('aws-sdk')

const s3Params = {
  Bucket: process.env.AWS_S3_BUCKET
}

const s3 = AWS.S3({
  accessKeyId: process.env.AWSAccessKeyId as string,
  secretAccessKey: process.env.AWSSecretKey as string,
  params: {
    ...s3Params
  }
})

s3.upload({
	Body: file, // Buffer
	Key: ' path/to/file.png'
}, (err, data) => { // Finished })
florinrelea