How to Securely Purchase a Domain and Route It to an S3-Hosted Static
Website Using AWS
This guide explains step-by-step how to purchase a domain in AWS, host a
static website on S3, and configure Route 53 and CloudFront to ensure
the site is secure and accessible via HTTPS.
1. Purchase a Domain on Route 53
- Go to AWS Route 53.
-
Choose Registered domains >
Register domain.
-
Search and choose your desired domain (e.g.,
yourdomain.com
).
-
Complete the registration and payment process (usually ~$12-14/year).
2. Create and Configure an S3 Bucket for Static Hosting
- Go to the S3 console.
-
Create a new bucket named exactly as your domain (e.g.,
yourdomain.com
).
- Disable block all public access.
-
Upload your site files (e.g.,
index.html
,
styles/
, img/
, app.js
).
-
Go to Properties >
Static website hosting.
- Enable static website hosting.
- Set index document:
index.html
-
Go to Permissions >
Bucket Policy and add:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::yourdomain.com/*"
}
]
}
3. Request an SSL Certificate in ACM
-
Go to AWS Certificate Manager (ACM) in
us-east-1 (N. Virginia).
-
Click Request certificate >
Public certificate.
-
Add two domain names:
yourdomain.com
www.yourdomain.com
- Choose DNS validation.
-
Create the required CNAME records in Route 53 (automated if hosted
there).
- Wait until status becomes "Issued".
4. Create a CloudFront Distribution
- Go to CloudFront.
- Create distribution:
-
Origin domain:
yourdomain.com.s3-website-us-east-1.amazonaws.com
- Viewer protocol policy: Redirect HTTP to HTTPS
- Default root object:
index.html
- Alternate domain name (CNAME):
yourdomain.com
- Custom SSL certificate: Select your ACM certificate
-
Create distribution and wait ~15 minutes until status is "Deployed".
5. Update Route 53 DNS Records
-
Go to Route 53 > Hosted Zones >
yourdomain.com
- Create a new A record:
- Name:
yourdomain.com
- Type: A – IPv4 address
- Alias: Yes
- Alias target: select your CloudFront distribution
-
Repeat above for the main domain
www.yourdomain.com
, and
optionally create a redirect bucket and forward it to
yourdomain.com
6. (Optional) Redirect www.yourdomain.com to yourdomain.com
- Create a second S3 bucket named
www.yourdomain.com
- Enable static website hosting.
-
Set it to redirect requests to
yourdomain.com
. No need to
upload any files.
-
Update Route 53 to point
www.yourdomain.com
to this
bucket (Alias record).
7. Final Validation and Troubleshooting
- Visit
https://yourdomain.com
in your browser.
-
If changes don't appear:
- Re-upload files to S3.
- Invalidate CloudFront cache (
/*
).
-
Ensure all files (HTML, CSS, JS, images) are uploaded to root or
correct folders.
-
Use browser dev tools (Network tab) to check for 403 or missing
file errors.
-
Success! Your domain is now securely routed to a static site hosted on
S3 and served via HTTPS with CloudFront.