Files copied to the S3 bucket are not public
I followed the instructions but it didn't work out of the box. I had to go to the S3 bucket with the static files and make them all public.
Hi @kevindqc - did you deploy to a region other than us-east-1 by any chance? I ran in to a similar issue just recently, and seems like there's a mis-configuration in the CloudFront S3 origin that causes it to fail in other regions.
I'm about to raise a PR, but essentially the fix would be to add a region specifier in the template.yaml's CloudFrontDistribution:
Origins:
- DomainName: !Sub "${StaticWebsiteBucket}.s3.${AWS::Region}.amazonaws.com"
Id: the-s3-bucket
Because the assets are served through CloudFront (and, when it's working, CloudFront authenticates to the bucket via an OriginAccessIdentity), the bucket would not actually need to be public.
Hi @kevindqc The files should not be public; the files should be available only to CloudFront to be served through it. Seems like the problem is caused by the missing region in the domain name like @athewsey said (Thanks, @athewsey !). I've just pushed the fix. I'll close the ticket. Please, reopen it if the problem persists.