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

  1. Go to AWS Route 53.
  2. Choose Registered domains > Register domain.
  3. Search and choose your desired domain (e.g., yourdomain.com).
  4. Complete the registration and payment process (usually ~$12-14/year).

2. Create and Configure an S3 Bucket for Static Hosting

  1. Go to the S3 console.
  2. Create a new bucket named exactly as your domain (e.g., yourdomain.com).
  3. Disable block all public access.
  4. Upload your site files (e.g., index.html, styles/, img/, app.js).
  5. Go to Properties > Static website hosting.
  6. Enable static website hosting.
  7. Set index document: index.html
  8. 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

  1. Go to AWS Certificate Manager (ACM) in us-east-1 (N. Virginia).
  2. Click Request certificate > Public certificate.
  3. Add two domain names:
    • yourdomain.com
    • www.yourdomain.com
  4. Choose DNS validation.
  5. Create the required CNAME records in Route 53 (automated if hosted there).
  6. Wait until status becomes "Issued".

4. Create a CloudFront Distribution

  1. Go to CloudFront.
  2. Create distribution:
  3. Origin domain: yourdomain.com.s3-website-us-east-1.amazonaws.com
  4. Viewer protocol policy: Redirect HTTP to HTTPS
  5. Default root object: index.html
  6. Alternate domain name (CNAME): yourdomain.com
  7. Custom SSL certificate: Select your ACM certificate
  8. Create distribution and wait ~15 minutes until status is "Deployed".

5. Update Route 53 DNS Records

  1. Go to Route 53 > Hosted Zones > yourdomain.com
  2. Create a new A record:
  3. Name: yourdomain.com
  4. Type: A – IPv4 address
  5. Alias: Yes
  6. Alias target: select your CloudFront distribution
  7. 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

  1. Create a second S3 bucket named www.yourdomain.com
  2. Enable static website hosting.
  3. Set it to redirect requests to yourdomain.com. No need to upload any files.
  4. Update Route 53 to point www.yourdomain.com to this bucket (Alias record).

7. Final Validation and Troubleshooting