问题描述
我正在尝试向s3中的现有帐户授予权限。
存储桶归该帐户所有,但数据是从另一个帐户的存储桶中复制的。 / p>
当我尝试使用以下命令授予权限时:
aws s3api put-object-acl --bucket< bucket_name> --key< folder_name> --profile< original_account_profile> --grant-full-control emailaddress =< destination_account_email>
我收到错误:
调用PutObjectAcl操作时发生错误(NoSuchKey):指定的键不存在。
而如果我在单个文件上执行,则命令成功。
如何使它适合完整文件夹?
您将需要运行
您可以使用以下命令来简化该过程:
aws s3 cp --acl bucket-owner-full-control --metadata Key = Value --profile< original_account_profile> s3:// bucket / path s3:// bucket / path
即复制文件
如果您有子目录,则添加-recursive
。
I am trying to grant permissions to an existing account in s3.
The bucket is owned by the account, but the data was copied from another account's bucket.
When I try to grant permissions with the command:
aws s3api put-object-acl --bucket <bucket_name> --key <folder_name> --profile <original_account_profile> --grant-full-control emailaddress=<destination_account_email>
I receive the error:
An error occurred (NoSuchKey) when calling the PutObjectAcl operation: The specified key does not exist.
while if I do it on a single file the command is successful.
How can I make it work for a full folder?
You will need to run the command individually for every object.
You might be able to short-cut the process by using:
aws s3 cp --acl bucket-owner-full-control --metadata Key=Value --profile <original_account_profile> s3://bucket/path s3://bucket/path
That is, you copy the files to themselves, but with the added ACL that grants permissions to the bucket owner.
If you have sub-directories, then add --recursive
.
这篇关于如何使用AWS s3或AWS s3api递归更改权限到文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!