I have a website working with nodeJs. In here users can upload their pictures. I'm using Wasabi to store that pictures. My problem is everytime a user send a picture to server it will save it with private condition. Because of that after uploading users can't see the picture. I need to make it public on the bucket so users can see it. My all buckets are free to read but everytime I upload a file it will be private. How can I make every uploaded picture public?
these are my upload params
const paramsForUpload = {
Bucket: bucketName,
Key: filePath,
Body: file.data,
};
const options = {
partSize: 10 * 1024 * 1024, // 10 MB
queueSize: 10,
};
s3.upload(paramsForUpload,options, (err) =>{
....
})
My policy
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowPublicRead",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::bucketname"
},
{
"Sid": "AddPerm",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::bucketname"
}
]
}
Thanks for helping