Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon web services Gulp AWS访问被拒绝问题_Amazon Web Services_Amazon S3_Gulp - Fatal编程技术网

Amazon web services Gulp AWS访问被拒绝问题

Amazon web services Gulp AWS访问被拒绝问题,amazon-web-services,amazon-s3,gulp,Amazon Web Services,Amazon S3,Gulp,这是我第一次设置一个用于发布的Gulp任务,也是我第一次深入使用AWS,而不仅仅是使用其他人已经设置的内容 调用任务时出现的错误是AccessDenied:Access Denied,我的代码是: gulp.task('publish-staging', function() { var publisher = awspublish.create({ params: { Bucket: 'my-bucket', key: 'mykey', secr

这是我第一次设置一个用于发布的Gulp任务,也是我第一次深入使用AWS,而不仅仅是使用其他人已经设置的内容

调用任务时出现的错误是
AccessDenied:Access Denied
,我的代码是:

gulp.task('publish-staging', function() {
  var publisher = awspublish.create({
    params: {
      Bucket: 'my-bucket',
      key: 'mykey',
      secret: 'mysecret',
      region: 'myregion'
    }
  });
  var headers = {
    'Cache-Control': 'max-age=315360000, no-transform, public',
    'Content-Encoding': 'gzip'
  };
  return gulp.src('build/**')
    .pipe(awsPubRouter({
      routes: {
        '^index\\.html$': {
          headers: Object.assign({}, headers, { 'Cache-Control': 'no-cache' })
        },
        '^.+$': { headers: headers }
      }
    }))
    .pipe(awspublish.gzip())
    .pipe(parallelize(publisher.publish(), 10))
    .pipe(awspublish.reporter());
});
我的政策是:

{
"Version": "2012-10-17",
"Id": "Policy1529361802241",
"Statement": [
    {
        "Sid": "statement-id-1",
        "Effect": "Allow",
        "Principal": {
            "AWS": "arn:aws:iam::848046242589:user/myuser@email.com"
        },
        "Action": "s3:*",
        "Resource": "arn:aws:s3:::my-bucket/*"
    },
    {
        "Sid": "statement-id-2",
        "Effect": "Allow",
        "Principal": "*",
        "Action": "s3:GetObject",
        "Resource": "arn:aws:s3:::my-bucket/*"
    },
    {
        "Sid": "statement-id-3",
        "Effect": "Allow",
        "Principal": "*",
        "Action": "s3:PutObjectAcl",
        "Resource": "arn:aws:s3:::my-bucket/*"
    }
  ]
}

这是否有明显的问题,或者问题可能在其他地方?

可能与Bucket的“公共访问设置”有关

尝试取消勾选“阻止新的公共ACL并上载公共对象”和“删除通过公共ACL授予的公共访问权限”,如下所示: