试图找出一种使用Boto3在S3存储桶中的对象上设置ACL的方法。输入应为S3存储桶名称,并将所有对象的ACL更改为仅公共读取
From the boto3 docs
To change the ACL of a single object, first get the Object instance and then change the ACL. This next example does both:
(boto3
.session
.Session(region_name=<region_name>)
.resource('s3')
.Object(<bucket_name>, <key>)
.Acl()
.put(ACL='public-read'))
Run Code Online (Sandbox Code Playgroud)
To change the ACL of a bucket, assuming you already have the bucket instance:
bucket.Acl().put(ACL='public-read')
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2508 次 |
| 最近记录: |