是否有任何限制用户创建文件夹的桶策略或IAM策略。例如。让我们考虑一下,我有一个用户- User1,我提供了用户对S3桶中某些文件夹的访问权限。我需要以这样的方式限制用户,使用户只能上传和下载对象。用户甚至不应该有创建文件夹的权限。那能办到吗?如果可以这样做,应该添加什么和在哪里?(桶策略或IAM策略)
发布于 2022-07-18 05:52:55
在中没有这样的东西叫做“文件夹”,所以您不能禁止创建不存在的东西。您在S3控制台中所看到的“文件夹”只是S3对象密钥的一种可视化表示形式,在它们的名称中包含了/。
发布于 2022-07-18 12:54:46
我已经解决了这一点,我自己,我有一个桶策略,限制用户只上传某一类型的文件。因此,创建文件夹不会自动工作。下面将提到我使用的桶策略作为参考。
{
"Version": "2012-10-17",
"Id": "Policy1657799010112",
"Statement": [
{
"Sid": "Stmt1657798687256",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:PutObject",
"Resource": [
"arn:aws:s3:::testbucketforuploadlimitation/Retailer 1/Latest/Start*.gz",
"arn:aws:s3:::testbucketforuploadlimitation/Retailer 2/Latest/Dollar/TrendedDetails-Dollar*.xlsx",
"arn:aws:s3:::testbucketforuploadlimitation/Retailer 2/Latest/Unit/TrendedDetails-Unit*.xlsx",
"arn:aws:s3:::testbucketforuploadlimitation/Retailer 3/Latest/0*.xlsx",
"arn:aws:s3:::testbucketforuploadlimitation/Retailer 3/Latest/1*.xlsx",
"arn:aws:s3:::testbucketforuploadlimitation/Retailer 4/Latest/Start*.gz",
"arn:aws:s3:::testbucketforuploadlimitation/Retailer 5/Latest/Start*.gz",
"arn:aws:s3:::testbucketforuploadlimitation/Retailer 6/Latest/TY/Start*.xlsx",
"arn:aws:s3:::testbucketforuploadlimitation/Retailer 6/Latest/YA/Start*.xlsx"
]
},
{
"Sid": "Stmt1657798687256",
"Effect": "Deny",
"Principal": "*",
"Action": "s3:PutObject",
"NotResource": [
"arn:aws:s3:::testbucketforuploadlimitation/Retailer 1/Latest/Start*.gz",
"arn:aws:s3:::testbucketforuploadlimitation/Retailer 2/Latest/Dollar/TrendedDetails-Dollar*.xlsx",
"arn:aws:s3:::testbucketforuploadlimitation/Retailer 2/Latest/Unit/TrendedDetails-Unit*.xlsx",
"arn:aws:s3:::testbucketforuploadlimitation/Retailer 3/Latest/0*.xlsx",
"arn:aws:s3:::testbucketforuploadlimitation/Retailer 3/Latest/1*.xlsx",
"arn:aws:s3:::testbucketforuploadlimitation/Retailer 4/Latest/Start*.gz",
"arn:aws:s3:::testbucketforuploadlimitation/Retailer 5/Latest/Start*.gz",
"arn:aws:s3:::testbucketforuploadlimitation/Retailer 6/Latest/TY/Start*.xlsx",
"arn:aws:s3:::testbucketforuploadlimitation/Retailer 6/Latest/YA/Start*.xlsx"
]
}
]}
https://stackoverflow.com/questions/73017794
复制相似问题