I want to host a static website on an Amazon Simple Storage Service (Amazon S3) bucket. Then, I want to serve my website through a CloudFront distribution. How can I do that?

Follow these steps to host a static website on Amazon S3 and to serve the website through Amazon CloudFront:

1. Use the Amazon S3 console to create a bucket and to enable static website hosting on the bucket.

2. From the Static website hosting dialog box, copy the Endpoint of your bucket without the leading http://. The format is similar to bucketname.s3-website-region.amazonaws.com. You need the endpoint in this format for a later step.

3. Add a bucket policy that allows public read access to the bucket that you created.

4. Create a CloudFront web distribution. Be sure to configure the following:

  • For Origin Domain Name, type the endpoint that you copied in step 2.
  • For Allowed HTTP Methods, select GET, HEAD, OPTIONS.
  • For Alternate Domain Names (CNAMEs), type the CNAME you want to use for your website.

5. If you don't want to use SSL (HTTPS) for your website, proceed to the next step. If you want to use SSL for your website, you can choose Request or Import a Certificate with ACM to request a certificate. For more information, see Using Alternate Domain Names and HTTPS.

6. Choose Create Distribution.

7. Update the DNS records for your domain to point your website's CNAME to your CloudFront distribution's domain name. Your distribution's domain name can be found in the CloudFront console in a format that is similar to d1234abcd.cloudfront.net.

8. Wait for your DNS changes to propagate and the previous DNS entries to expire.


Did this page help you? Yes | No

Back to the AWS Support Knowledge Center

Need help? Visit the AWS Support Center

Published: 2018-06-20