Last active
May 27, 2017 06:20
-
-
Save HyunSeob/3a809febbfc44eba55e4cb7618080261 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const AWS = require('aws-sdk'); | |
const BUCKET_NAME = 'your-s3-bucket-name'; | |
const s3 = new AWS.S3(); | |
exports.handler = (event, context, callback) => { | |
const { name, body } = event; | |
s3.putObject({ | |
Bucket: BUCKET_NAME, | |
Key: `${name}.txt`, | |
ContentType: 'text/plain', | |
Body: body, | |
}, (err, data) => { | |
if (err) { | |
return callback(err); | |
} | |
callback(null, data); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment