Skip to content

Instantly share code, notes, and snippets.

@fsjorgeluis
Last active June 20, 2022 21:14
Show Gist options
  • Save fsjorgeluis/6c04533e74641af3e6280b28a890ce21 to your computer and use it in GitHub Desktop.
Save fsjorgeluis/6c04533e74641af3e6280b28a890ce21 to your computer and use it in GitHub Desktop.
aws cdk layer: s3-manager helper
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