When serving a website via CloudFront from an S3 bucket, I would typically apply the following Bucket Policy to allow access to my files:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Allow Public Access to All Objects",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::somewhere.example.com/*"
}
]
}
But Amazon have recently started showing this message (bold emphasis mine):
We highly recommend that you never grant any kind of public access to your S3 bucket.
The AWS documentation is very inconsistent with this advice, suggesting that only write access is an issue. I'm serving a website so obviously I'm quite happy giving public access to the files, particularly since directory listings are still not allowed.
As of November 2017, what is the recommended way of connecting CloudFront to an S3 bucket, without giving any public access?