Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object.copy does not use UploadPartCopy for an s3<->s3 transfer #335

Closed
vincer opened this issue May 1, 2024 · 2 comments
Closed

Object.copy does not use UploadPartCopy for an s3<->s3 transfer #335

vincer opened this issue May 1, 2024 · 2 comments

Comments

@vincer
Copy link

vincer commented May 1, 2024

  • Async AWS SDK for Python version: 12.4.0
  • Python version: 3.12.3
  • Operating System: macOS 14.4.1

Description

I'm doing an S3 to S3 copy of a large file (multiple GB) which should happen S3-side only using UploadPartCopy. Instead, it seems to be downloading and then reuploading the object using UploadPart. The end result is the same, but the download/upload is unnecessary, wasting bandwidth and takes longer.

Works as expected with boto3. https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3/object/copy.html

What I Did

        b = await s3.Bucket("destination")
        obj = await b.Object("key")
        await obj.copy({"Bucket": "source", "Key": "key"})

in boto3 it works as expected:

        b = s3.Bucket("destination")
        obj = b.Object("key")
        obj.copy({"Bucket": "source", "Key": "key"})
@terricain
Copy link
Owner

Yeah thats expected as when the code was written, UploadPartCopy did not exist :D

@terricain
Copy link
Owner

In v13.0.0 the s3.copy function has been rewritten and now utilises s3.copy_object or s3.upload_part_copy. FYI the default threshold in the S3 Transfer config object is 8MiB, s3.copy can copy objects up to 5GiB so bumping that for copies probably makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants