How can I restrict access to an S3 website to Cloudfront

0 votes

I want to put a Cloudfront CDN in front of a S3 website bucket for a static website, and restrict read access of the bucket to the Cloudfront distribution. Pretty common, and documented by AWS and other sources. But for some reason I can’t get it to work.

I also tried tweaking values in PublicAccessBlockConfiguration and AccessControl and tried uploading bucket content with aws s3 sync … --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers.

But I always end up with either public S3 content, or content being unavailable via Cloudfront as well.

Does anybody have an idea what else I could try?

Mar 22, 2022 in Others by Edureka
• 13,690 points
2,590 views

1 answer to this question.

0 votes

Make a CloudFront access identity for origin access (OAI)

1. Log in to CloudFront's management console.

2. Select the distribution that serves material from the S3 bucket to which access should be restricted from the list of distributions.

3. Select the Origins option from the drop-down menu.

4. Choose Edit and then select the S3 origin.

5. Select Yes to use OAI for S3 bucket access (bucket can restrict access to only CloudFront).

6. Choose an existing identity from the selection list or create a new OAI for Origin access identity.

7. Select Yes to update the bucket policy in the Bucket policy section.
Note: This step modifies your S3 origin's bucket policy to grant OAI access to the following buckets:
GetObject.

Select Save Changes from the drop-down menu.

If you need to know more about Cloud Computing, We recommend joining Cloud Computing Certification today.

answered Mar 24, 2022 by Edureka
• 13,690 points

Related Questions In Others

0 votes
1 answer

How Can I Round Prices to the nearest 0.95 with an Excel Formula?

Try this: =IF(OR(A3-FLOOR(A3,1)>0.95,A3=CEILING(A3,1)),CEILING ...READ MORE

answered Oct 9, 2022 in Others by narikkadan
• 63,600 points
702 views
0 votes
1 answer

How can I add a wildcard to my if formula (that also contains an or condition)

3 Try: The formula in B1: =IF(SUM(COUNTIF(A1,{"* IDE","* IDE-?"})),"Y","N") Or, a little ...READ MORE

answered Feb 2, 2023 in Others by narikkadan
• 63,600 points
572 views
0 votes
1 answer
0 votes
0 answers

how can I deploy a test in pytest framework to airflow using DAG?

I have established an automative testing framework ...READ MORE

Oct 4, 2021 in Others by Yuan
• 120 points
668 views
0 votes
1 answer

How to maximize SEO of an internationalized website?

there is no single answer to SEO ...READ MORE

answered Feb 11, 2022 in Others by narikkadan
• 63,600 points
556 views
0 votes
1 answer

how do i to forward domain.com to www.domain.com at godaddy for s3 hosted site?

Go to GoDaddy.com and enter your username ...READ MORE

answered Mar 10, 2022 in Others by gaurav
• 23,260 points
633 views
0 votes
0 answers

How to disable Amazon S3 raw endpoint access

Hosting  a static website on S3 : You ...READ MORE

Apr 10, 2022 in Others by Kichu
• 19,040 points
952 views
0 votes
2 answers

How to copy a formula horizontally within a table using Excel VBA?

Hi so basically, create an adjacent column ...READ MORE

answered Feb 16, 2022 in Others by Edureka
• 13,690 points
1,059 views
0 votes
1 answer

How to convert data from txt files to Excel files using python

Hi , there are few steps to ...READ MORE

answered Feb 16, 2022 in Others by Edureka
• 13,690 points
14,028 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP