11/27/2020

s3 bucket copy object to another bucket, python example

 code

def copy_s3_object(s3_resource, source_bucket_name, source_key, target_bucket_name, target_key):
copy_source = {'Bucket': source_bucket_name, 'Key': source_key}
s3_resource.meta.client.copy(copy_source, target_bucket_name, target_key)

s3_resource = boto3.resource('s3')
copy_s3_object(s3_resource, source_bucket_name, source_key, target_bucket_name, target_key)

.