gpt4 book ai didi

amazon-s3 - 执行 S3 标准存储类的策略

转载 作者:行者123 更新时间:2023-12-03 21:35:24 25 4
gpt4 key购买 nike

有没有办法定义 S3 存储桶策略来强制执行标准存储类?我想阻止用户创建具有减少的冗余存储类的对象。

最佳答案

您现在可以使用 S3 存储桶策略中的条件将 S3 对象的创建(使用 PutObject)限制为特定的存储类。

AWS 文档的当前版本有一个示例 - Restrict object uploads to objects with a specific storage class .

Suppose Account A owns a bucket and the account administrator wants to restrict Dave, a user in Account A, to be able to only upload objects to the bucket that will be stored with the STANDARD_IA storage class. The Account A administrator can accomplish this by using the s3:x-amz-storage-class condition key as shown in the following example bucket policy.


{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "statement1",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::AccountA-ID:user/Dave"
},
"Action": "s3:PutObject",
"Resource": [
"arn:aws:s3:::examplebucket/*"
],
"Condition": {
"StringEquals": {
"s3:x-amz-storage-class": [
"STANDARD_IA"
]
}
}
}
]
}

您对 Principal 的值(value)和 Resource将特定于您的用户和 S3 存储桶。 Condition约束需要更改为 STANDARD .

关于amazon-s3 - 执行 S3 标准存储类的策略,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24158796/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com