当前位置: 动力学知识库 > 问答 > 编程问答 >

How to transfer an Amazon S3 bucket to another account?

问题描述:

I configure AWS instances for clients, and I need to transfer everything to them at the end, so that the billing for AWS and S3 usage also goes on their accounts.

I know there is a way to "transfer" an EC2 instance via AMI sharing, but is there a way to transfer ownership or share S3 buckets as well? (Preferably avoid making a copy but transfer the original bucket itself).

网友答案:

S3 Buckets cannot be transferred between accounts. At least in the simple sense of "here is my bucket, now it is your bucket". Everyone seems to use some form of copying. If you have permission to both your original bucket and their destination bucket then you can use the AWS CLI and just

aws s3 sync s3://bucket1 s3://bucket2

Have you tried adding their account as an ALL PERMISSION user to one of your buckets? http://docs.aws.amazon.com/IAM/latest/UserGuide/roles-creatingrole-policyexamples.html

Then login as their account and see if they can then edit the policy to remove your original account? Not sure how the billing would turn out since you created the bucket.

网友答案:

You can transfer the contents of the buckets between accounts by making the destination bucket public (There are more secure ways to do this). Then using the aws CLI from the other account you authenticated with run the s3 cp command (This does not need bandwidth):

aws s3 cp "s3://bucket-source/file.zip" "s3://bucket-you-dont-own/NewFolder/" --acl bucket-owner-full-control

If you do not add "--acl bucket-owner-full-control" to your s3 string you will get an access denied error because the destination account does not have file permissions:

A client error (AccessDenied) occurred when calling the ListObjects operation: Access Denied

分享给朋友:
您可能感兴趣的文章:
随机阅读: