s3:PutBucketPolicy Access Denied

,

Hi,

I am following the guidelines to create S3 bucket which is served via CloudFront.
S3 bucket does not need a public access, as the content is served from CloudFront.

It seems that CloudFormation does not have the permission to generate the required S3 policy.
Due to that, I receive the following error:

CREATE_FAILED: S3AccessPolicy (AWS::S3::BucketPolicy)
API: s3:PutBucketPolicy Access Denied

Could it be related to the following:

serverless.yml

resources:
  Resources:
    ## Specifying the S3 Bucket
    ReactAppBucket:
      Type: AWS::S3::Bucket
      Properties:
        BucketName: ${self:custom.bucketName}
        WebsiteConfiguration:
          IndexDocument: index.html
          ErrorDocument: index.html
    ## Specifying the policies to make sure all files inside the Bucket are avaialble to CloudFront
    S3AccessPolicy:
      Type: AWS::S3::BucketPolicy
      Properties:
        Bucket:
          Ref: ReactAppBucket
        PolicyDocument:
          Statement:
            - Sid: PublicReadGetObject
              Effect: Allow
              Principal: '*'
              Action:
                - s3:GetObject
              Resource: arn:aws:s3:::${self:custom.bucketName}/*
            - Sid: AllowPutBucketPolicy
              Effect: Allow
              Principal: '*'
              Action:
                - s3:PutBucketPolicy
              Resource: arn:aws:s3:::${self:custom.bucketName}

AWS made changes to S3 bucket access, I created a pull request updating the example: