I'm trying to use this command to set the static website hosting:
aws s3api put-bucket-website --bucket XXXX --website-configuration file://assets/website.json
website.json
{
"IndexDocument": {
"Suffix": "index.html"
},
"ErrorDocument": {
"Key": "index.html"
}
}
bucket policy
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "AllowPublicRead",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": [
"s3:GetObject"
],
"Resource": "arn:aws:s3:::XXXX/*"
}
]
}
I'm getting the error:
An error occurred (AccessDenied) when calling the PutBucketWebsite operation: Access Denied
What should I change in the bucket policy?