Last active
June 20, 2022 21:14
-
-
Save fsjorgeluis/6c04533e74641af3e6280b28a890ce21 to your computer and use it in GitHub Desktop.
aws cdk layer: s3-manager helper
This file contains hidden or 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
module.exports.putObjectToS3 = async ({ S3 }, bucketName, key, data) => { | |
const s3 = new S3({ apiVersion: '2006-03-01' }); | |
const params = { | |
Bucket: bucketName, | |
Key: key, | |
Body: JSON.stringify(data), | |
}; | |
s3.putObject(params, function (err, data) { | |
if (err) { | |
console.log(err, err.stack); | |
} else { | |
console.log(data); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment