Reputation: 1845
I have a public S3 Bucket, with the public policy set like this
{
"Version": "2012-10-17",
"Id": "Policy1563368389080",
"Statement": [
{
"Sid": "Stmt1563368385984",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": [
"s3:GetObject",
"s3:GetObjectVersion"
],
"Resource": [
"arn:aws:s3:::mybucketname/*",
"arn:aws:s3:::mybucketname"
]
}
]
}
However when i upload a new file it isn't public by default. Is there something wrong with my policy?
Upvotes: 5
Views: 6780
Reputation: 269101
The problem is here:
"Principal": {
"AWS": "*"
},
It should be:
"Principal": "*",
Upvotes: 1
Reputation: 1330
To make it public by default you need to add below code under bucket policy of you respective aws S3 bucket.
{
"Version":"2012-10-17",
"Statement":[{
"Sid":"PublicReadGetObject",
"Effect":"Allow",
"Principal": "*",
"Action":["s3:GetObject"],
"Resource":["arn:aws:s3:::example-bucket/*"
]
}
]
}
Upvotes: 7