AWS S3 您的存储桶策略可能会阻止文件夹创建

huangapple go评论76阅读模式
英文:

AWS S3 Your bucket policy might block folder creation

问题

创建一个新文件夹在现有存储桶中,每次都会在AWS S3控制台页面的顶部显示这条消息。我在创建文件夹或上传数据方面没有遇到任何问题,那么这实际上是什么意思呢?我似乎找不到任何关于为什么会显示这个消息的答案,也许这只是默认设置,不管策略如何设置?

您的存储桶策略可能会阻止文件夹的创建
如果您的存储桶策略阻止上传没有特定标签、元数据或访问控制列表(ACL)授权的对象,您将无法使用此配置创建文件夹。相反,您可以使用上传配置上传一个空文件夹,并指定适当的设置。

英文:

Creating a new folder in an existing bucket displays this message at the top of the AWS S3 Console page every time. I am not running into any problems creating folders or uploading data so what does this actually mean? I can't seem to find any answers as to why this is displayed, perhaps its just default no matter the policy setup?

> Your bucket policy might block folder creation
If your bucket policy prevents uploading objects without specific tags, metadata, or access control list (ACL) grantees, you will not be able to create a folder using this configuration. Instead, you can use the upload configuration to upload an empty folder and specify the appropriate settings.

答案1

得分: 2

只确认S3桶的新用户界面在创建文件夹时显示此消息!

AWS S3 您的存储桶策略可能会阻止文件夹创建

还确认了桶上没有默认策略配置。我认为S3团队引入了这个警告,以保持用户界面友好和信息丰富。

英文:

Just confirmed that the new user interface of S3 bucket now shows this message when creating a folder!

AWS S3 您的存储桶策略可能会阻止文件夹创建

It is also confirmed that the bucket had no default policy configured on it. I think that this warning was introduced by the S3 team to keep the user interface friendly and informative.

答案2

得分: 1

在S3中不存在文件夹,空文件夹不会被明确创建,但可以通过创建表示所需文件夹结构的键的零字节对象来模拟。

查看这个帖子:AWS S3中的空文件夹

即使如此,如果您仍然无法放置对象或上传零字节对象,可能与以下内容有关:

https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-folders.html

> 如果您的存储桶策略禁止在没有标签、元数据或访问控制列表(ACL)授权的情况下向存储桶上传对象,您无法使用以下过程创建文件夹。相反,上传一个空文件夹,并在上传配置中指定以下设置。

以下是授予存储桶上putObjects权限以及"文件夹结构"中的示例S3策略:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "s3:ListBucket",
        "s3:PutObject"
      ],
      "Resource": "arn:aws:s3:::your-bucket-name"
    },
    {
      "Effect": "Allow",
      "Action": [
        "s3:GetObject",
        "s3:PutObject",
        "s3:DeleteObject",
        "s3:ListBucketMultipartUploads",
        "s3:AbortMultipartUpload",
        "s3:ListMultipartUploadParts"
      ],
      "Resource": "arn:aws:s3:::your-bucket-name/*"
    }
  ]
}
英文:

Folders doesn't exist in S3, empty folders are not created explicitly but can be simulated by creating zero-byte objects with keys that represent the desired folder structure.

Check out this thread: Empty folders in AWS S3

Even after that being said you still can't put objects or upload the zero-byte objects, it may be related to this:

https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-folders.html

> If your bucket policy prevents uploading objects to this bucket without tags, metadata, or access control list (ACL) grantees, you can't create a folder by using the following procedure. Instead, upload an empty folder and specify the following settings in the upload configuration.

Here is an example of a S3 policy that grants access to putObjects on the bucket and in the "folder structure":

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "s3:ListBucket",
        "s3:PutObject"
      ],
      "Resource": "arn:aws:s3:::your-bucket-name"
    },
    {
      "Effect": "Allow",
      "Action": [
        "s3:GetObject",
        "s3:PutObject",
        "s3:DeleteObject",
        "s3:ListBucketMultipartUploads",
        "s3:AbortMultipartUpload",
        "s3:ListMultipartUploadParts"
      ],
      "Resource": "arn:aws:s3:::your-bucket-name/*"
    }
  ]
}

huangapple
  • 本文由 发表于 2023年7月6日 21:16:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/76629264.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定