我能够使用 lambda 函数执行将数据从源存储桶复制到目标存储桶的任务,但是,在 Step 函数中执行 lambda 函数时出现错误。以下是我从头开始遵循的步骤。
import json
import boto3
s3_client=boto3.client('s3')
# lambda function to copy file from 1 s3 to another s3
def lambda_handler(event, context):
#specify source bucket
source_bucket_name=event['Records'][0]['s3']['bucket']['name']
#get object that has been uploaded
file_name=event['Records'][0]['s3']['object']['key']
#specify destination bucket
destination_bucket_name='final.bucket'
#specify from where file needs to be copied
copy_object={'Bucket':source_bucket_name,'Key':file_name}
#write copy …Run Code Online (Sandbox Code Playgroud)