Interview Prep/AWS/S3, EBS and EFS

An S3 static website endpoint returns `403 Forbidden` with `Code: AccessDenied`.

IntermediateTroubleshootingS3, EBS and EFS
Answer

Likely causes → Block Public Access is on at the account or bucket level, or no bucket policy grants s3:GetObject to *. Also check that the index document exists exactly as named (keys are case-sensitive) and that objects are not KMS-encrypted (website endpoints cannot serve SSE-KMS objects).

Diagnose →

aws s3control get-public-access-block --account-id 111111111111
aws s3api get-public-access-block --bucket my-site
aws s3api get-bucket-policy --bucket my-site
aws s3api get-bucket-website --bucket my-site
aws s3 ls s3://my-site/index.html

Fix →

  1. In production, keep the bucket private and put CloudFront with OAC in front of it
  2. If a public website endpoint is truly intended, turn off BPA for that bucket only and add a read-only public policy for arn:aws:s3:::my-site/*

Prevent → Keep account-level BPA on, and serve all public content through CloudFront.

aws All AWS questions Roadmap: AWS core services

More on S3, EBS and EFS