Amazon S3 allows you to set permissions on file basis or per bucket. That is very helpful since you sometimes want to share a complete bucket with the rest of the internet.
With the help of bucket policies you're able to make an S3 bucket publicly readable. However, you have a lot permission options available. Use the AWS Policy Generator to create your access policies.
For this example, we only want to set read access for everyone. Go to your AWS Management Console and select the bucket you want to set the policy for. Now, click the Properties button on the right top corner to show the bucket properties.
A sidebar appears. Within this sidebar select Permissions and Add bucket policy.
Within the modal window, paste the code below:
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "AllowPublicRead",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": [
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::<your-bucket-name>/*"
]
}
]
}
Please change <your-bucket-name> with the name of your bucket that you want to make readable. After you set the policy, all created objects in this bucket are readable for everyone.
Thanks to Ariejan for his valuable blog post! It helped a lot to find the correct bucket settings.