anhlu8
11/19/2018 - 2:01 AM

Save an object to S3

Save an object to S3

const AWS = require('aws-sdk');
const s3 = new AWS.S3();
const bucket = process.env.BUCKET_NAME;

module.exports = async (event) => {
    const params = {
        Bucket: bucket, 
        Key: 'alliances.json.gz', 
        Body: event}

    s3.putObject(params, function (err, data) {
        if (err) {
            return console.log("Error", err)
        }
        return console.log("Success", data);
    });
}