S3Bucket


S3 Bucket WebSite Hosting

Create a S3 Bucket with a unique name,set it public,set the bucket policy,set it for static website hosting.

Set an index html and an error html

Use a CloudFront web distribution and set the origin as this newly created bucket

During the CloudFront configuration, Set domain name and default document as index.html otherwise it won’t work

you can access it using the cloudfront as https://abc.cloudfront.net where abc will be in the cloudfront distribution config that you set up.

Cloudflare as an alternate

Use Cloudflare to forward to a S3 bucket created with name www.mywebsite

In Cloudflare DNS set www in CNAME and set value www.mywebsite.s3-website.us-east-1.amazonaws.com

www.mywebsite should now show the index html page

Allow Access to a S3 bucket only from a CloudFront Distribution

On the CloudFront distribution Set up a Origin Access Identity to restrict the bucket from being accessed directly.

This prevents users from accessing the objects via Amazon S3 URLs.

Review the bucket policy to make sure only OAI can access the bucket.


These writings represent my own personal views alone.
Licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.