boto3:使用禁用ACL的S3存储桶

发布于 2025-02-08 10:41:09 字数 425 浏览 2 评论 0原文

我正在尝试使用Boto3和Python在S3上创建一个新的存储桶。但是,我希望其ACL被禁用。我已经尝试了以下代码,但是ACL仍然启用。如何使用boto3禁用ACL?

s3.create_bucket(
    Bucket = BUCKET_NAME,
    CreateBucketConfiguration = {
        'LocationConstraint': REGION_NAME
    },
    ACL='private'
)

I am trying to create a new bucket on S3 using boto3 and python. However, I want its ACLs to be disabled. I have tried the following code, but ACLs are still enabled. How can I disable ACLs using boto3?

s3.create_bucket(
    Bucket = BUCKET_NAME,
    CreateBucketConfiguration = {
        'LocationConstraint': REGION_NAME
    },
    ACL='private'
)

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

动听の歌 2025-02-15 10:41:09

create_bucket SDK无法控制对象所有权。

我认为您需要指示buckeTownerEnforced在调用 put_bucket_ownhips_controls ,在创建了存储桶后。

The create_bucket SDK does not control Object Ownership.

I think that you need to indicate the BucketOwnerEnforced rule when calling put_bucket_ownership_controls, after the bucket has been created.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文