How to make CodePipe public index.html pages to web s3

0

Hello-
Trying to send index.html files to a public S3 bucket for public-web-hosting. Is there a way to automatically make public these files that deposited into the public bucket? Because these files are being set to default/private when deposited into the bucket.

My goal is to create a pipeline that deposits index.html files into a public S3 bucket. The tutorial is at:
https://docs.aws.amazon.com/codepipeline/latest/userguide/tutorials-s3deploy.html?shortFooter=true

I’m successfully using git-commands to push and commit files (such as index.html) from my laptop to the CodeCommit Repository.

I created a CodePipeline that uses CodeCommit to “send” and “deploy” the web files to the public bucket; which again is triggered by my git push. Web files are definitely sent to the bucket; but I have to select “Make Public” to each file to have the bucket host out that index.html (Otherwise the common / infamous XML, Access Denied error message).

Due to this simplicity (or the simplicity I was hoping for) I am not using CodeBuild nor CodeDeploy. Simply sending out an index.html file.

Is there a configuration I am missing? Thank you.

已提問 5 年前檢視次數 230 次
1 個回答
0

Solution:
There must be a bucket policy to AllowPublicRead.
And this is in addition to enabling bucket for web hosting.
{"Version": "2008-10-17",
"Statement": [{"Sid": "AllowPublicRead",
"Effect": "Allow",
"Principal": {
"AWS": ""
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::YOUR-BUCKET-NAME/
"
}]}

已回答 5 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南