Skip to content

Instantly share code, notes, and snippets.

@oismaelash
Created November 29, 2019 23:24
Show Gist options
  • Save oismaelash/d77874fea41bc9a1829f76625631f9cb to your computer and use it in GitHub Desktop.
Save oismaelash/d77874fea41bc9a1829f76625631f9cb to your computer and use it in GitHub Desktop.
const AWS = require('aws-sdk');
var s3 = new AWS.S3();
exports.handler = (event, context, callback) => {
var params = {
"Body": event.base64,
"Bucket": "my-bucket",
"Key": 'filename.jpeg',
"ACL": 'public-read',
"ContentType": 'image/jpeg'
};
s3.upload(params, function(err, data){
if(err) {
callback(err, null);
} else {
callback(null, data);
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment