mesaekso
mesaekso

Reputation: 1

AWS cannot open or download after copy files to different Amazon S3 bucket using Boto3

I have created a lambda with boto3 that copies files from one Amazon S3 bucket to a different account's Amazon S3 bucket. Everything works fine, but when the other user is trying to open or download the files gets access denied or cannot download the files. I have the bucket location of the other account and the kms key and i have created policy role for that on my bucket. My bucket has encryption enabled. Do i need to decrypt my files and encrypt with the kms key of the other account ? I am testing with https://docs.aws.amazon.com/kms/latest/developerguide/programming-encryption.html#reencryption is this correct ? Thanks

Upvotes: 0

Views: 185

Answers (1)

Daniel Scott
Daniel Scott

Reputation: 7913

This is probably an object ownership issue. You will need to grant the destination bucket bucket-owner-full-control to the object when uploading. You can set a bucket policy which blocks uploads unless the uploader grants this access:

https://docs.aws.amazon.com/AmazonS3/latest/userguide/about-object-ownership.html

Upvotes: 2

Related Questions