I discovered via a discussion on Twitter that S3 exposes URLs that support HTTPS.
See this related question for more context: https://serverfault.com/questions/965935/what-are-the-differences-between-all-the-s3-urls
The URL format is much simpler as well: https://<bucket>.s3.amazonaws.com/<file> (no need for the region).
The documentation should be updated to use these new URLs.
Warning: I have no idea if these alternative URLs are compatible with custom domains. Also I don't know if these work with static website hosting too (if they serve index.html). It might be worth checking.
A few things to note:
index.php on a Lambda function and configure your project to load assets from S3 domain, you would be able to still have your php site on a custom domain while loading assets from non-custom domain.:+1: thank you!
I got an answer on ServerFault:
https://<bucket>.s3.amazonaws.com/<file> and the now deprecated https://s3.<region>.amazonaws.com/<bucket>/<file> are REST endpointshttp://<bucket>.s3-website-<region>.amazonaws.com/<file> is the website endpoint and supports only HTTP
https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteEndpoints.html#WebsiteRestEndpointDiff
I confirm that https://<bucket>.s3.amazonaws.com/<file> URLs works as CloudFront origins as well.
FYI, when your bucket name contains dots, the HTTPS version does not work. The certificate is a wildcard for subdomains, but eg. mywebsite.com will not work on HTTPS, only HTTP.
FYI, update from AWS: https://aws.amazon.com/blogs/aws/amazon-s3-path-deprecation-plan-the-rest-of-the-story/
@barryvdh
FYI, when your bucket name contains dots, the HTTPS version does not work. The certificate is a wildcard for subdomains, but eg. mywebsite.com will not work on HTTPS, only HTTP.
That makes sense when using the https://bucket.with.a.dot.s3.amazonaws.com/ URL.
But it is possible to use custom domains with S3. What you have to do is name the bucket after the domain name. For example www.website.com.
In that case, https://www.website.com.s3.amazonaws.com/ will not work. But do you know if https://www.website.com will work correctly?