From Lambda, duplicate a S3 folder (object) tree

0

I am trying to duplicate a tree (2 levels) of objects in executing the Lambda. I have searched online and found many examples using boto3 & s3pathlib. I've made sure that the IAM account executing the Lambda created the S3 bucket and folders. I've made sure that the IAM account has the correct permissions. I've even added IAM permissions for executing Lambda as described in https://repost.aws/knowledge-center/lambda-copy-s3-files.

Regardless of any of the examples, the execution fails. Not in the lambda code but deeper in a library....the error is the same regardless of what Lambda function I try - I've written 5 of them.

Any help would be appreciated! I'm stuck.

  • Can you update your answer to include the actual error you are getting...

Petrus
질문됨 3달 전75회 조회
1개 답변
0

Tricky... please try the following: Make sure the IAM role used by the Lambda function has the necessary permissions to access the source and destination buckets. This includes s3:GetObject and s3:PutObject permissions.

When copying objects, the ownership does not automatically transfer to the destination bucket account. You need to explicitly grant the destination bucket owner permissions to the copied objects.

Try copying an object while setting the ACL to grant the destination bucket full control. For example:

aws s3 cp s3://source-bucket/object s3://destination-bucket/object --acl bucket-owner-full-control Verify the bucket policy on the destination bucket allows the Lambda execution role to put objects.

Check for any explicit Deny policies that may be blocking access.

profile picture
전문가
답변함 3달 전
  • This creates more questions...but first some answers for you. Thanks in advance....

    Just checked - The IAM DOES HAVE permissions for s3:GetObject & s3:PutObject.

    Your example: aws s3 cp s3://source-bucket/object s3://destination-bucket/object --acl bucket-owner-full-control Are you suggesting this is placed in the Lambda Python function I wrote? Is this statement in Python?

    You also say: Verify the bucket policy on the destination bucket allows the Lambda execution role to put objects.

    You also say: Check for any explicit Deny policies that may be blocking access. Where and how to do this?

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠