This project demonstrates how to host a static website using Amazon S3. The website is a simple HTML page with associated assets, fully hosted on S3, showcasing how to leverage AWS for static content delivery.
- Static Website Hosting: Accessible via a public URL provided by S3.
- Custom Error Pages: Configured custom error pages for a better user experience.
- Access Management: Implemented AWS S3 Bucket Policies and ACLs to control public access.
- Log in to the AWS Management Console.
- Navigate to the
S3 service
. - Create a new bucket:
- Give it a unique name (e.g., my-awesome-website-bucket).
- Choose a region closest to your target audience (e.g., Asia Pacific (Mumbai)
ap-south-1
).
- Enable ACLs:
- During bucket creation, under "Object Ownership," select ACLs enabled.
- This allows fine-grained control over the permissions of individual objects in the bucket.
- Upload your website files:
- Upload index.html and the unzipped folder to the S3 bucket.
- Ensure the directory structure is preserved during the upload.
- Go to the bucket properties in the S3 console.
- Enable static website hosting:
- In the "Static website hosting" section, choose Enable.
- Set index.html as the Index document.
- Optionally, set a custom error document like error.html.
- Use the bucket's public URL to access the website. It typically looks like:
http://your-bucket-name.s3-website-region.amazonaws.com
ACLs are a set of rules that determine who can access your S3 resources. In this project, ACLs were used to manage public access to the website.
-
Why Use ACLs?: ACLs allow you to grant specific read/write permissions to different AWS accounts or make the content public. This provides more granular control compared to bucket policies.
-
Implementation:
- After uploading your files, select them in the S3 console.
- From the "Actions" dropdown, choose "Make public using ACL".
- This action grants public read access to the website files, resolving any 403 errors when accessing the bucket endpoint.
- 403 Forbidden Error: If you encounter this error, ensure that the objects in your bucket are made public using ACLs.
The project uses Amazon S3 to host a static website, where the following steps were performed:
- S3 Bucket: Created for storing the website files.
- Website Hosting: Enabled to make the bucket's content publicly accessible.
- ACLs: Configured to allow public access to the website.
I deleted the resources from my AWS console to avoid costs, so this GitHub repository serves as the sole showcase for my work on this project. I have documented all the steps and details to ensure a comprehensive understanding of my approach.