This project demonstrates how to set up a static website using AWS services. The goal is to quickly host a website using S3 buckets, while testing other features like timed presigned URLs, bucket policies, bucket versioning, and linking a domain to it through Amazon Route 53.
- Log in to your AWS Management Console
- Navigate to the Route 53 service
- Purchase desired domain
- Navigate to the S3 service
- Click on "Create bucket", use the exact name as your domain, and follow the prompts to create a new bucket
- Enable Static Website Hosting, and choose your root html file, e.g.
index.html
- Navigate to Route 53 service and click on the default Hosted Zone
- Click on "Create a new record", click on "Switch to wizard", choose "simple routing policy", and follow the prompts
- Navigate to your bucket
- Click the "Upload" button
- Upload your index.html and related folders that contain any css, images, scripts
- Navigate to your bucket
- Click the checkbox on index.html and other folders
- Under Actions dropdown, click on "Make public using ACL"
- Upload the desired file into your S3 bucket
- Click the checkbox for that file
- Under Actions dropdown, click on "Share with a presigned URL" and input desired duration
- Bucket Name: same as purchased domain (or any bucket name if not using your Route 53 domain)
- Region: ap-southeast-2
- Public Access: Enabled
- ACL: Enabled
- Versioning: Enabled
- Static Website Hosting: Enabled
- Record type: A
- Endpoint: Alias to S3 website endpoint
- Region: same as above
- Evaluate Target Health: Off
- Access the S3 bucket at the domain purchased (or at URL given at Properties > Static Website Hosting, if not using your Route 53 domain)
-
Issue 1: Unable to access S3 bucket.
- Solution: Check the bucket's public access settings and ensure the bucket policy allows public access.
-
Issue 2: "No target available" when linking Hosted Zone to S3 bucket.
- Solution: Ensure that Static Website Hosting has been enabled first, and that your bucket name follows your domain name exactly, as in
sample-domain.com
- Solution: Ensure that Static Website Hosting has been enabled first, and that your bucket name follows your domain name exactly, as in