2017-10-04 132 views
0

我正嘗試將權限授予s3中的現有帳戶。如何將權限遞歸更改爲使用AWS s3或AWS s3api的文件夾

存儲桶歸該帳戶所有,但數據是從另一個帳戶的存儲桶複製的。

當我嘗試給予用命令的權限:

aws s3api put-object-acl --bucket <bucket_name> --key <folder_name> --profile <original_account_profile> --grant-full-control emailaddress=<destination_account_email> 

我收到的錯誤:

An error occurred (NoSuchKey) when calling the PutObjectAcl operation: The specified key does not exist. 

而如果我這樣做對單個文件的命令是成功的。

我該如何讓它適用於完整的文件夾?

+0

'ObjectACL'只支持'files'和'bucket',不支持'folder'。所以你不能爲''文件夾定義ACL。您爲存儲桶級別定義ACL的最簡單解決方案。例如:''Resource「:」arn:aws:s3 ::: BUCKET_NAME/*「' –

回答

0

您需要分別爲每個對象運行命令。

您可能能夠走捷徑的過程中使用:

aws s3 cp --acl bucket-owner-full-control --profile <original_account_profile> s3://bucket/path s3://bucket/path 

也就是說,您將文件複製到自己,但與添加ACL授予權限桶所有者。

如果您有子目錄,請添加--recursive

相關問題