AWS S3 node.js SDK uploaded file and folder permissions
Found it http://docs.aws.amazon.com/AmazonS3/latest/dev/ACLOverview.html#CannedACL
need to add option in putObject
or upload
:
ACL:'public-read'
The following works like a charm. (Note the ACL key in params)
const params = {
Bucket: bucketName + path,
Key: key,
Body: buffer,
ContentEncoding: 'base64',
ContentType: 'image/jpeg',
ACL:'public-read'
};
await s3.putObject(params).promise();
Note: IAM permission "s3:PutObjectACL" must be included in the appropriate policy otherwise you will get Access Denied errors.