Meghna helps you serve a
static website on Amazon S3
using Amazon CloudFront

Meghna_BLR0718

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

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

Warning: These steps are specific to hosting a static website on Amazon S3 by configuring your bucket for website hosting. To use your bucket for website hosting, the objects for your website must be publicly readable. For more information, see Permissions Required for Website Access.

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, enter the endpoint that you copied in step 2.
  • For Allowed HTTP Methods, select GET, HEAD, OPTIONS.
  • For Alternate Domain Names (CNAMEs), enter 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. You can find your distribution's domain name in the CloudFront console in a format that is similar to d1234abcd.cloudfront.net.

8.    Wait for your DNS changes to propagate and for 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

Updated: 2019-01-11