Cloudfront distribution for S3 Public Website - custom origin not working but S3 origin working ? Why ?

0 was trying this exercise in my account : I configured a public S3 bucket as static website and hosted website by uploading the Helloworld files Worked well Enter image description here
Enter image description here

Next step I wanted to create a cloud front distribution with Custom S3 origin as shown was selected. Other settings left default. Selected website S3 endpoint as shown while selecting the bucket as shown in figure Enter image description here

The resultant cloudfront distribution is giving Error as follows : Enter image description here

Step : 2 Created other Cloudfront Distribution with S3 origin and this worked fine as follows Why ? Enter image description here

WHY This difference in Distribution hosted from S3 and Custom Origin

PFA the two cloudfront distribution : Enter image description here

1 Answer

When you choose a custom origin you're accessing some arbitrary website by URL. So you need to provide a website URL like in your first image, with "s3-website" in it. The "origin domain" you provided as shown in your second image is not pointing to the S3 bucket's static website.

When you use an S3 origin you're not accessing the bucket's static website, you're accessing its REST interface. You could (and should!) disable the static website and make the bucket non-public, and this will stll work via the Origin Access Identity.

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions