Reputation: 137
I am getting an error when trying to access the bucket using url. Click http://awsweatherbucket.s3.ap-south-1.amazonaws.com/ to get the error details. The bucket policy is as follows:
{
"Version": "2008-10-17",
"Id": "PolicyForPublicWebsiteContent",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::awsweatherbucket/*"
}
]
}
Please help me resolve the issue. Thanks in Advance.
Upvotes: 0
Views: 310
Reputation: 51634
It is listing the bucket content as an XML response, which is the correct behavior, when the bucket is not configured for static website hosting.
To load the actual website, you can directly call index.html at:
http://awsweatherbucket.s3.ap-south-1.amazonaws.com/index.html
To correctly configure the bucket, please refer to the AWS user guide.
Alternatively, if you are using the AWS CLI, you can also configure the bucket using the following command:
aws s3 website s3://awsweatherbucket/ --index-document index.html --error-document error.html
Note, you don't have an error-document in your bucket, but you should. That's where the user will be redirected when they are trying to access a page that doesn't exist.
Upvotes: 1