question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CopyObject in SDK V2- how to specify the copy version

See original GitHub issue

Expected Behavior

In version 1 of the sdk - you could specify the following code to perform a copy on a particular version of a file

 CopyObjectRequest copyObjectRequest =new CopyObjectRequest(fromBucketName, fromObjectKey, toBucketName, toObjectKey).withSourceVersionId(versionId);

s3Client.copyObject(copyObjectRequest);

Current Behavior

I cant seem to figure out with version 2 of the SDK how to specify the version when performing a copy

Possible Solution

Is it possible to specify a version on the copyObject command? If so could the documentation be updated with the correct syntax to use

Your Environment

  • AWS Java SDK version used: 2.10.65
  • JDK version used: Amazon 11 Corretto
  • Operating System and version: Mac OS Catalina 10.15.3

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
damogallaghercommented, Jul 22, 2021

Hi @damogallagher. Please take a look at the new copy source support introduced by #2612 and let me know if this helps satisfy your use case.

@Bennett-Lynch Yes this looks easy to use. Thanks for following up with me on this item

1reaction
Bennett-Lynchcommented, Jul 21, 2021

Hi @damogallagher. Please take a look at the new copy source support introduced by https://github.com/aws/aws-sdk-java-v2/pull/2612 and let me know if this helps satisfy your use case.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CopyObject - Amazon Simple Storage Service
For more information, see Copy Object Using the REST Multipart Upload API. ... If you don't specify a version ID, Amazon S3 copies...
Read more >
AWS Java SDK 2 S3 copy object - Stack Overflow
In the version 2 SDK, the Builder for CopyObjectRequest does not have a clear way to set the source vs destination. There is...
Read more >
Copy an object from one Amazon S3 bucket to another using ...
The following code examples show how to copy an S3 object from one bucket to ... For API details, see CopyObject in Amazon...
Read more >
CopyObjectRequest (AWS SDK for Java - 2.18.34)
If you don't specify a version ID, Amazon S3 copies the latest version of the source object. Returns: Specifies the source object for...
Read more >
How to Copy or Move Objects from one S3 bucket to another ...
Using the AWS S3 CLI Tool. So here are the ingredients for this recipe again as discussed in part 1: 2 - S3...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found