Reputation: 2266
I'm googling since several hour without solution.
I'm trying to manage my bucket as web directory but it's not working fine.
Here is my bucket policy :
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::my_bucket/*"
}
]
}
I have an index html file at top level of the bucket, and a directory.
I can access the index file like this :
https://s3-eu-west-1.amazonaws.com/my_bucket/my_index_file.html
But all the following request give an xml access access denied error
https://s3-eu-west-1.amazonaws.com/my_bucket/
https://s3-eu-west-1.amazonaws.com/my_bucket
https://s3-eu-west-1.amazonaws.com/my_bucket/my_folder
https://s3-eu-west-1.amazonaws.com/my_bucket/my_folder/my_sub_folder
I haven't found a solution. Please let me konow if someone know how to achieve this, so that I can browse my bucket through firefox or another browser.
Thanks
Upvotes: 3
Views: 6916
Reputation: 590
Set bucket policy for both like below:
{ "Version": "2012-10-17", "Statement": [ { "Sid": "PublicReadGetObject", "Effect": "Allow", "Principal": "", "Action": "s3:GetObject", "Resource": "arn:aws:s3:::example.com/" } ] }
Follow this link : https://docs.aws.amazon.com/AmazonS3/latest/dev/website-hosting-custom-domain-walkthrough.html
Upvotes: 0
Reputation: 16532
If you want to make the static website hosting with the necessary index.html & default pages - you need to enable S3 Static Website Hosting. Just making the files / S3 objects public wouldn't help the index.html routing.
Once you do that you would get URLs like - http://examplebucket.s3-website-us-east-1.amazonaws.com/
Checkout the following links
Upvotes: 2