AWS:S3 存储桶 AWS 您无法授予公共访问权限,因为此帐户已启用阻止公共访问设置

问题描述 投票:0回答:5

我想让 S3 存储桶向所有人公开,但当我这样做时,我的访问被拒绝,它说

You can't grant public access because Block public access settings 
are turned on for this account. To determine which settings are 
turned on, check your Block public access settings.

enter image description here

当我进入公共访问设置时,所有内容都已关闭。

enter image description here

我确实设置了 IAM 用户并且用户具有 AmazonS3FullAccess 策略

{
"Version": "2012-10-17",
"Statement": [
    {
        "Effect": "Allow",
        "Action": "s3:*",
        "Resource": "*"
    }
  ]
 }

我确实在存储桶上设置了策略

{
"Version": "2012-10-17",
"Id": "Policy1557294263403",
"Statement": [
    {
        "Sid": "Stmt1557294241958",
        "Effect": "Allow",
        "Principal": {
            "AWS": "arn:aws:iam::726051891502:user/borroup-admin"
        },
        "Action": "s3:*",
        "Resource": [
            "arn:aws:s3:::borroup",
            "arn:aws:s3:::borroup/*"
        ]
      }
    ]
 }

我确实在存储桶上设置了 CORS 配置编辑器

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>PUT</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>Authorization</AllowedHeader>
</CORSRule>
</CORSConfiguration>
ruby-on-rails amazon-web-services amazon-s3 aws-sdk
5个回答
18
投票

似乎必须从“权限”和“阻止公共访问”(帐户设置)两个地方取消选中它。

enter image description here


1
投票

在处理 Rails 项目时,我使用 AWS S3 存储桶来存储图像,也遇到了同样的挑战。

这是我解决的方法

  1. 单击并打开您想要驻留的资产/图像/文件的存储桶。

enter image description here

  1. 单击存储桶页面顶部菜单的“权限”选项卡

enter image description here

  1. 单击阻止公共访问(存储桶设置)部分中的编辑。然后取消勾选阻止所有公共访问。然后保存您的更改。

enter image description here

注意:您可以从给定的选项中选择您想要的公共访问类型。

仅此而已。

我希望这有帮助


1
投票

我希望您已经解决了这个问题,如果没有,请转到编辑公共访问设置 Edit public access settings

然后在下一个屏幕中输入确认以继续更改

confirm


0
投票

除了 walterc 的回答之外,如果有人仍然遇到问题,我必须单击我想要访问的特定文件,并单击该文件的“公开”,因为仅将存储桶公开不适用于特定文件链接访问。


0
投票

转到您的存储桶,单击权限选项卡,然后从两个位置取消阻止公共访问(存储桶设置)。 enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.