Copy files between two S3 buckets belonging to two different acconts

Hi All,

I have some experience with AWS S3 and lambdas but I was always working within one AWS account.

Now I want to copy a file (up to 2GB) from one S3 bucket belonging to AWS account A into other S3 bucket belonging to AWS account B. Account A is a partner account to which I have API access via accessKey and secret access key. Account B is my organization’s account to which I have admin rights.

Can I copy the file directly to my bucket? I mean without downloading the file to lambda instance and then uploading to my S3 bucket?

The S3 copyObject method seems to support copying across buckets. Have you tried using it? If the role the Lambda uses for execution has access to both buckets I don’t think it would matter if they were owned by different accounts.

https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#copyObject-property