kk-static-demo).
Project structure and files
Project files for this demo:
index.html
index.html). That page, in turn, loads index.css and images from the images/ folder.
Create the S3 bucket
- Open the Amazon S3 console and create a new bucket. In this demo the bucket name was
kk-static-demo. Leave other settings as default for a simple test deployment.

Upload your website files
- Upload
index.html,index.css,404.html, and theimages/folder to the bucket. Upload duration depends on image sizes.

Enable static website hosting
- Go to the bucket’s Properties tab.
- Find Static website hosting and click Edit (or Enable).
- Choose Host a static website and set:
- Index document:
index.html - Error document:
404.html
- Index document:
- Save the settings.
The “Index document” defines the default object S3 returns when no specific object is requested (site root). The “Error document” is returned when a requested object is missing.


Initial “Access Denied” and required permissions
- After enabling website hosting, visiting the site endpoint may return “Access Denied” if your objects are not publicly retrievable. S3 static website hosting requires that objects be readable by the principal you intend (commonly anonymous public read for public websites).
Make the bucket objects retrievable (public read)
- In the bucket Permissions tab → Block public access, click Edit. To apply a public bucket policy you must first disable the block that prevents public policies from being added.

- Confirm the change when prompted. The console warns that this may make objects public; you must type
confirmand proceed.

- Add a bucket policy that allows public read (
s3:GetObject) to objects. Replacekk-static-demowith your bucket name:
- This policy grants anonymous users read access to GET objects in the bucket. It does not grant deletion, write, or other privileged permissions.
If your bucket’s Object Ownership is set to “Bucket owner enforced” (which disables ACLs), granting public read via ACLs won’t work — use a bucket policy (like the example above) to allow
GetObject. Conversely, if you rely on ACLs, ensure ACLs are enabled and not blocked by the Block Public Access settings.Confirming the website endpoint
- Open the bucket Properties → Static website hosting and click the site endpoint.
- Visiting the root URL (no object specified) returns
index.htmlautomatically — you don’t need to append/index.html. - You can fetch specific objects directly, for example:
https://<bucket-website-endpoint>/images/food1.jpg
- Requesting a non-existent object returns your configured error document (
404.html) and displays your custom 404 page.
Amazon S3 static website endpoints serve content over HTTP only (no HTTPS). If you need HTTPS, place a CDN such as Amazon CloudFront in front of the bucket and configure an origin access control (OAC) or origin access identity (OAI) so you can keep the bucket private while serving content securely over HTTPS.
Quick reference: common settings
Links and references
- Amazon S3 static website hosting — https://docs.aws.amazon.com/AmazonS3/latest/userguide/WebsiteHosting.html
- Amazon S3 bucket policies — https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-iam-policies.html
- Amazon CloudFront (use for HTTPS + custom domain) — https://aws.amazon.com/cloudfront/