如何使用AWS s3或AWS s3api递归更改权限到文件夹 [英] How to change permission recursively to folder with AWS s3 or AWS s3api

查看:399
本文介绍了如何使用AWS s3或AWS s3api递归更改权限到文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试向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递归更改权限到文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆