How to set up a custom domain for an S3 static website?

To set up a custom domain for an S3 static website, follow these steps:

  1. Register a domain name with a domain registrar. This is the unique web address that users will use to access your website.

  2. Go to your Amazon S3 dashboard and select the bucket that hosts your static website.

  3. Click on the "Properties" tab and then select "Static website hosting."

  4. Enable static website hosting and enter the index document and error document file names (e.g., index.html for the index document).

  5. In the "Static website hosting" pane, you will see the endpoint URL for your static website. Copy this endpoint URL.

  6. Go to the control panel of your domain registrar and find the option to manage your domain's DNS settings.

  7. Add a new CNAME record that points your domain name to the S3 endpoint URL you copied earlier. The CNAME record should have the following format: [subdomain.yourdomain.com] CNAME [s3-website-region.amazonaws.com]

  8. Save your changes and wait for them to propagate. This process can take up to 48 hours, so be patient.

  9. Once the changes have propagated, you should be able to access your static website using your custom domain name.

By following these steps, you can easily set up a custom domain for your S3 static website and provide users with a branded web address to access your content.