Hot questions for Using Amazon S3 in aws java sdk 2.x
In the version 1 SDK, making a copy request was straightforward with:
new CopyObjectRequest(sourceBucket, sourceKey, destinationBucket, destinationKey)
In the version 2 SDK, the
CopyObjectRequest does not have a clear way to set the source vs destination. There is a
copySource(copySource) method which accepts a full path, but there is no obvious way to set the destination bucket or destination key or to set the source bucket and source key normally (without building a full path and dealing with URL encoding).
They have a pretty good example here on Github: https://github.com/awsdocs/aws-doc-sdk-examples/blob/master/javav2/example_code/s3/src/main/java/com/example/s3/CopyObject.java