S3 website with CloudFront distribution 403 access denied error
Contents
Problem
I’m using an AWS S3 bucket configured as a static website endpoint as the origin of a CloudFront distribution for this website. I pulled up my website to browse it and I started getting access denied errors as soon as I tried to click any link.
My endpoint was specified incorrectly.
Solution
- Open the CloudFront console.
- Choose your CloudFront distribution, and then choose Distribution Settings.
- Choose the Origins and Origin Groups tab.
- Review the domain name under Origin Domain Name and Path.
REST API endpoints use the format:
BUCKET-NAME.s3.amazonaws.com
Website endpoints use the format:
BUCKET-NAME.s3-website-us-east-1.amazonaws.com
where s3-website-us-east-1 more generically is s3-website-REGION
That fixed my problem, but there are other issues that could also lead to the same error message.