The objective of this document is to guide users through the process of adding a custom domain to an AWS S3 bucket, including steps for creating the bucket, setting up static website hosting, configuring CloudFront for content delivery, requesting an SSL certificate, and updating DNS settings.


Step 1: Create an S3 Bucket

  1. Create a new S3 bucket:
  2. Enable static website hosting:
  3. Upload your website content:

Step 2: Set Bucket Policy for Public Access

  1. Set a bucket policy to make your bucket contents publicly accessible:

    {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Sid": "PublicReadGetObject",
                "Effect": "Allow",
                "Principal": "*",
                "Action": "s3:GetObject",
                "Resource": "arn:aws:s3:::YOUR-BUCKET-NAME/*"
            }
        ]
    }
    

Step 3: Set Up a CloudFront Distribution

  1. Request an SSL Certificate: (Takes Time)

    <aside> đź’ˇ In CNAME record use only _a79865eas4cd1a6ewf90a45779b4e0b96**.api** CNAME instead of _a79865eas4cd1a6ewf90a45779b4e0b96**.api.example.com.** for faster approval

    </aside>

  2. Create a CloudFront distribution:


Step 4: Update DNS Settings

  1. Update DNS records at your domain registrar:

Step 5: Verify and Test

  1. Propagation: Allow some time for DNS changes to propagate (can take up to 24-48 hours, but usually quicker).