Amazon web services aws cdk s3:部署具有公共读取访问权限的bucket时,PutBucketPolicy访问被拒绝

Amazon web services aws cdk s3:部署具有公共读取访问权限的bucket时,PutBucketPolicy访问被拒绝,amazon-web-services,amazon-s3,aws-cdk,Amazon Web Services,Amazon S3,Aws Cdk,我正试图建立一个静态网站使用S3桶使用cdk。但是,当我部署堆栈时,我收到错误API:s3:PutBucketPolicy访问被拒绝。我使用的CLI用户具有管理员权限 我试图手动创建一个配置了“静态网站托管”属性的bucket,但是当我添加以下bucket策略时,我收到了一个拒绝访问错误,即使我是root用户 { "Id": "PolicyId", "Version": "2012-10-17", "Statement": [ { "Sid": "Sid",

我正试图建立一个静态网站使用S3桶使用cdk。但是,当我部署堆栈时,我收到错误
API:s3:PutBucketPolicy访问被拒绝
。我使用的CLI用户具有管理员权限

我试图手动创建一个配置了“静态网站托管”属性的bucket,但是当我添加以下bucket策略时,我收到了一个
拒绝访问
错误,即使我是root用户

 {
  "Id": "PolicyId",
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "Sid",
      "Action": "s3:*",
      "Effect": "Allow",
      "Resource": "arn:aws:s3:::BUCKET_NAME",
      "Principal": "*"
    }
  ]
}
类似于

我已取消选择所有建议的公共访问设置,但我仍然收到拒绝访问的消息

我相信部署cdk代码时出现的问题可能与手动创建bucket时出现的问题有关,但我不知道如何调试它。

这对我来说很有效:

        //Create the web bucket and give it public read access
        this.webBucket = new Bucket(this, 'WebBucket', {
            websiteIndexDocument: 'index.html',
            publicReadAccess: true
        });

        //Deploy the frontend to the to the web bucket
        new BucketDeployment(this, 'DeployFrontend', {
            source: Source.asset('../ui/dist'),
            destinationBucket: this.webBucket
        });
另外,请确保S3控制台中的“阻止公共访问(帐户设置)”已关闭。

这对我来说很有效:

        //Create the web bucket and give it public read access
        this.webBucket = new Bucket(this, 'WebBucket', {
            websiteIndexDocument: 'index.html',
            publicReadAccess: true
        });

        //Deploy the frontend to the to the web bucket
        new BucketDeployment(this, 'DeployFrontend', {
            source: Source.asset('../ui/dist'),
            destinationBucket: this.webBucket
        });

另外,请确保S3控制台中的“阻止公共访问(帐户设置)”已关闭。

我在此处发布了一个非常类似的问题:我可以通过更新到最新版本的CDK(1.32.2)来“解决”它。似乎有一些IAM的更改一定已经解决了这个问题。我在这里发布了一个非常类似的问题:我能够通过更新到CDK的最新版本(1.32.2)来“解决”它。似乎有一些IAM的变化,一定是解决了这个问题。