Amazon S3 changing object permissions retroactively

微笑、不失礼 提交于 2019-12-11 07:33:51

问题


I have a current S3 bucket with existing files.

The bucket was originally a public bucket, I changed its permissions to be private, but I already have objects that were uploaded and have public read CannedACL permissions.

How do I change the permissions on all of the uploaded objects to private CannedACL?


回答1:


You can use the AWS Command-Line Interface (CLI) to change the permissions in-bulk.

You will use the aws s3 cp command. While this is a copy command, it can also be used to copy files in place, which simply changes their permissions.

For example:

aws s3 cp s3://my-bucket/ s3://my-bucket/ --recursive --acl bucket-owner-full-control

(bucket-owner-full-control: Both the object owner and the bucket owner get FULL_CONTROL over the object.)

See also: Amazon S3 File Permissions, Access Denied when copied from another account




回答2:


aws s3 cp s3://my-bucket/ s3://my-bucket/ --metadata x-amz-meta-updated=1 --recursive --acl private



来源:https://stackoverflow.com/questions/50269283/amazon-s3-changing-object-permissions-retroactively

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!