I am trying to set up a static website using an S3 bucket using the cdk. However, when I deploy the stack I receive the error API: s3:PutBucketPolicy Access Denied
. The CLI user I am using has administrator permissions.
I have tried to manually create a bucket with the "Static website hosting" property configured, but when I add the following bucket policy, I receive an Access denied
error, even though I am the root user.
{
"Id": "PolicyId",
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Sid",
"Action": "s3:*",
"Effect": "Allow",
"Resource": "arn:aws:s3:::BUCKET_NAME",
"Principal": "*"
}
]
}
Something similar to here.
I have deselected all the public access settings like is suggested - but I still receive an access denied.
I believe the problem when deploying the cdk code may be related to the problem when creating the bucket manually, but I don't know how to debug it.