Verifique se o balde S3 existe em lambda
// import or require aws-sdk as AWS
// const AWS = require('aws-sdk');
const checkBucketExists = async bucket => {
const s3 = new AWS.S3();
const options = {
Bucket: bucket,
};
try {
await s3.headBucket(options).promise();
return true;
} catch (error) {
if (error.statusCode === 404) {
return false;
}
throw error;
}
};
Jumping Boy