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

  1. Open the CloudFront console.
  2. Choose your CloudFront distribution, and then choose Distribution Settings.
  3. Choose the Origins and Origin Groups tab.
  4. 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.