Skip to content

Instantly share code, notes, and snippets.

@ppshein
Last active March 27, 2020 03:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ppshein/a3975e90ed9089d5a1d11d4ba59e35d7 to your computer and use it in GitHub Desktop.
Save ppshein/a3975e90ed9089d5a1d11d4ba59e35d7 to your computer and use it in GitHub Desktop.
const AWS = require("aws-sdk");
const s3 = new AWS.S3({ apiVersion: "2006-03-01" });
const fs = require("fs");
AWS.config.update({
accessKeyId: "",
secretAccessKey: "",
region: "ap-southeast-1",
Bucket: "mobile-ayaplus-backend-dev",
})
const params = {
Bucket: `mobile-ayaplus-backend-dev`,
Key: `ayapay-merchant/mytestimage.png`,
Body: fs.createReadStream(`./mytestimage.png`),
ContentType: 'image/png',
StorageClass: 'STANDARD_IA'
};
s3.upload(params, function(err, result) {
if (err) {
throw err;
}
console.log(`File uploaded successfully. ${JSON.stringify(result)}`);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment