- Project file structure
- Configuring S3 for static hosting
- Setting public access and custom error pages
- Testing your site endpoint
Project Structure
Your local directory (static-demo/) contains:
index.html– Main gallery pageindex.css– Layout and styling rules404.html– Custom error pageimages/– JPEG photos used in the gallery

index.html
This HTML file defines the page structure and references your CSS and images:index.css defines a responsive grid layout, background colors, and typography. Place all JPEGs in the images/ folder.
404.html
When users request a missing resource, S3 serves this custom error page:You can preview both pages locally by opening
index.html in your browser. The CSS grid will display your food gallery.1. Create an S3 Bucket
- Open the Amazon S3 console and click Create bucket.
- Enter a unique bucket name (e.g.,
kk-static-demo) and select your region. - Keep default settings and click Create bucket.


2. Upload Website Files
- Click your bucket name to open it.
- Drag & drop
index.html,index.css,404.html, and theimages/folder into the console. - Choose Upload and confirm.

3. Enable Static Website Hosting
- In your bucket, navigate to Properties → Static website hosting → Edit.
- Select Enable.
- For Index document, enter
index.html. - For Error document, enter
404.html. - Save changes.



4. Configure Public Access
4.1 Disable Block Public Access
- Go to Permissions → Block public access (bucket settings) → Edit.
- Uncheck Block all public access and confirm.

4.2 Add a Bucket Policy
Still under Permissions, select Bucket policy and paste the following JSON (replace the ARN with your bucket name):

Making your bucket public exposes all objects. Ensure only intended files are uploaded.
5. Test Your Static Website
Return to Properties → Static website hosting and click the endpoint link. You should see the food gallery home page. You do not need to append/index.html—the index document is served automatically.

| Resource | URL Pattern |
|---|---|
| Home page | http://kk-static-demo.s3-website-<region>.amazonaws.com/ |
| Explicit index | http://kk-static-demo.s3-website-<region>.amazonaws.com/index.html |
| Specific image | http://kk-static-demo.s3-website-<region>.amazonaws.com/images/food1.jpg |
| Missing resource (404 page) | http://kk-static-demo.s3-website-<region>.amazonaws.com/does-not-exist |