We were using the AWS Java SDK-1.x version in our application till now. We decided to migrate to the 2.x. As per my analysis I have found out the equivalent function which we are using for 1.x client operation in 2.x in our application. But for some operation I could not able to find matching functions. Below are the details.
| 1.x (AmazonS3) | 2.x (S3AsyncClient) |
|---|---|
| getObject(String bucket, String key) | getObject(GetObjectRequest req, Path destination) |
| putObject(String bucket, String key, File file) | putObject(PutObjectRequest req, Path source) |
| generatePresignedUrl(GeneratePresignedUrlRequest req) | S3PreSigner.presignGetObject(GetObjectPresignRequest req) |
| deleteObject(String bucket, String key) | deleteObject(DeleteObjectRequest req) |
| getUrl(String bucket, String key) | ? |
| doesObjectExist(String bucket, String key) | ? |
Any help or pointer is really appreciated.
Below are the replacements for the methods that you are looking for in 2.x SDK:
getUrldoesObjectExistheadObjectHere is a complete mapping of S3 1.x and 2.0 Operations.