Make an S3 bucket public

08 Jul 2022 in TIL

I recently needed to make all objects in a bucket public, but not allow people to list the contents of the bucket. Finding the correct policy took me a little while, so I'm reproducing here for posterity:

json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Statement1",
"Effect": "Allow",
"Principal": "*",
"Action": [
"s3:GetObject"
],
"Resource": "arn:aws:s3:::BUCKET_NAME_HERE/*"
}
]
}