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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/412.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 s3 AWS S3通过来自Cloudfront的CanonicalUserPrincipal将禁止对象403放入bucket_Amazon S3_Amazon Cloudfront - Fatal编程技术网

Amazon s3 AWS S3通过来自Cloudfront的CanonicalUserPrincipal将禁止对象403放入bucket

Amazon s3 AWS S3通过来自Cloudfront的CanonicalUserPrincipal将禁止对象403放入bucket,amazon-s3,amazon-cloudfront,Amazon S3,Amazon Cloudfront,我有一个Cloudfront发行版,其中有两个bucket是不可公开访问的。 第一个bucket是App bucket,包含App源代码。 第二个bucket(罪魁祸首)是用户文件bucket,应用程序可以在其中上传文件 因此,当我的桶策略设置如下: { "Version": "2012-10-17", "Statement": [ { "Effect": &q

我有一个Cloudfront发行版,其中有两个bucket是不可公开访问的。 第一个bucket是App bucket,包含App源代码。 第二个bucket(罪魁祸首)是用户文件bucket,应用程序可以在其中上传文件

因此,当我的桶策略设置如下:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:Put*",
            "Resource": "arn:aws:s3:::user-files/*"
        }
    ]
}
上传工作正常。 但有了这个校长,我的桶是公开的。由于我不允许操作
Get
,我想没有人能准备好我的文件,但他们可以把东西放进桶里

因此,我试图通过添加一个
OriginAccessIdentity
作为主体来限制它

{
  "Effect": "Allow",
  "Principal": {
    "AWS": "arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity [IDENTITY CODE]"
  },
  "Action": "s3:Put*",
  "Resource": [
    "arn:aws:s3:::user-files",
    "arn:aws:s3:::user-files/*"
  ]
}
然而,当我部署它时,当我尝试上传时,我得到了一个403禁止。
我遗漏了什么?

您解决了这个问题吗?编辑:哦,不。。。上次见到是在二月