简体   繁体   English

我可以从 boto3 获取有关 S3 存储桶的公共访问存储桶设置的信息吗?

[英]Can I get information on an S3 Bucket's public access bucket Settings from boto3?

I am using boto3 to extract information about my S3 buckets.我正在使用 boto3 来提取有关我的 S3 存储桶的信息。
However, I am stuck at this point.但是,我被困在这一点上。 I am trying to extract information about a bucket's public access (see attached screenshot).我正在尝试提取有关存储桶的公共访问权限的信息(请参阅随附的屏幕截图)。

How can I get this information?我怎样才能得到这些信息? So far I have failed to find out any boto3 function that allows me to do so.到目前为止,我还没有找到任何允许我这样做的 boto3 function。

在此处输入图像描述

You can use get_public_access_block() :您可以使用get_public_access_block()

Retrieves the PublicAccessBlock configuration for an Amazon S3 bucket.检索 Amazon S3 存储桶的PublicAccessBlock配置。

When Amazon S3 evaluates the PublicAccessBlock configuration for a bucket or an object, it checks the PublicAccessBlock configuration for both the bucket (or the bucket that contains the object) and the bucket owner's account.当 Amazon S3 评估存储桶或 object 的PublicAccessBlock配置时,它会检查存储桶(或包含对象的存储桶)和存储桶所有者账户的PublicAccessBlock配置。 If the PublicAccessBlock settings are different between the bucket and the account, Amazon S3 uses the most restrictive combination of the bucket-level and account-level settings.如果存储桶和账户之间的PublicAccessBlock设置不同,Amazon S3 会使用最严格的存储桶级别和账户级别设置组合。

If you wish to modify the settings, you can use: put_public_access_block()如果你想修改设置,你可以使用: put_public_access_block()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM