我有一个公共(public) S3 存储桶,公共(public)策略设置如下
{
"Version": "2012-10-17",
"Id": "Policy1563368389080",
"Statement": [
{
"Sid": "Stmt1563368385984",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": [
"s3:GetObject",
"s3:GetObjectVersion"
],
"Resource": [
"arn:aws:s3:::mybucketname/*",
"arn:aws:s3:::mybucketname"
]
}
]
}
但是,当我上传新文件时,默认情况下它不是公开的。我的政策有问题吗?
最佳答案
要默认公开它,您需要在各自的 aws S3 存储桶的存储桶策略下添加以下代码。
{
"Version":"2012-10-17",
"Statement":[{
"Sid":"PublicReadGetObject",
"Effect":"Allow",
"Principal": "*",
"Action":["s3:GetObject"],
"Resource":["arn:aws:s3:::example-bucket/*"
]
}
]
}
关于amazon-web-services - S3 : Make uploaded files public by default,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58282974/