This project demonstrates the process of creating and hosting a static website using an Amazon S3 bucket. By following the steps outlined in this guide, you can quickly deploy a simple static website on Amazon Web Services (AWS).
This project focuses on the hosting of a static website, perfect for showcasing portfolios, project documentation, or personal blogs. Amazon S3 is utilized for its simplicity, scalability, and cost-effectiveness in hosting static content.
Before you begin, ensure you have the following prerequisites:
- An AWS account
- AWS CLI installed and configured with necessary credentials
- Basic knowledge of HTML, CSS, and JavaScript for customizing your website
-
Clone the Repository:
git clone https://github.com/yourusername/static-website-aws-s3.git
-
Navigate to the Project Directory:
cd static-website-aws-s3
-
Configure AWS CLI: Ensure your AWS CLI is configured with the necessary credentials.
-
Edit Website Content: Modify the HTML, CSS, and JavaScript files in the
public
directory to customize your website. -
Create S3 Bucket: Run the following AWS CLI command to create an S3 bucket for your website. Replace
your-bucket-name
with a unique name.aws s3 mb s3://your-bucket-name
-
Upload Website Files: Upload your website files to the S3 bucket.
aws s3 sync public/ s3://your-bucket-name
-
Set Bucket Policy: Update the bucket policy to allow public access. Modify the
bucket-policy.json
file with your bucket name and execute the following command:aws s3api put-bucket-policy --bucket your-bucket-name --policy file://bucket-policy.json
-
Enable Website Hosting: Enable static website hosting on the S3 bucket.
aws s3 website s3://your-bucket-name --index-document index.html --error-document error.html
-
Access Your Website: Once the setup is complete, your website will be accessible at the provided endpoint.
Visit your website's endpoint to view your hosted static website. Share the URL with others to showcase your content.
Feel free to customize the website content, style, and structure according to your preferences. Update the HTML, CSS, and JavaScript files in the public
directory.
Contributions are welcome! Fork the repository, make your changes, and submit a pull request. Please follow the existing coding style and guidelines.