AWS Java SDK 2.0 create a presigned URL for a S3 object

As mentioned by @Anurudhha in the comment, it is not yet supported in SDK 2.0. Here is the link to the official backlog

Here is a workaround from the feature request, which can help you as of now

This is now supported for S3's GetObject. See here.

  // Create an S3Presigner using the default region and credentials.
      // This is usually done at application startup, because creating a presigner can be expensive.
      S3Presigner presigner = S3Presigner.create();

      // Create a GetObjectRequest to be pre-signed
      GetObjectRequest getObjectRequest =

      // Create a GetObjectPresignRequest to specify the signature duration
      GetObjectPresignRequest getObjectPresignRequest =

      // Generate the presigned request
      PresignedGetObjectRequest presignedGetObjectRequest =

      // Log the presigned URL, for example.
      System.out.println("Presigned URL: " + presignedGetObjectRequest.url());

      // It is recommended to close the S3Presigner when it is done being used, because some credential
      // providers (e.g. if your AWS profile is configured to assume an STS role) require system resources
      // that need to be freed. If you are using one S3Presigner per application (as recommended), this
      // usually is not needed.

This is also now supported for S3's PutObject. Example here.

S3Presigner presigner = S3Presigner.create();
PresignedPutObjectRequest presignedRequest =
    presigner.presignPutObject(r -> r.signatureDuration(Duration.ofMinutes(5))
                                        .putObjectRequest(por -> por.bucket(testBucket).key(objectKey)));

System.out.println("Pre-signed URL to upload a file to: " + 
System.out.println("Which HTTP method needs to be used when uploading a file: " + 
System.out.println("Which headers need to be sent with the upload: " + 

Here's an example of uploading to S3 using a PresignedPutObjectRequest:

PresignedPutObjectRequest presignedRequest = ...;
SdkHttpClient httpClient = ApacheHttpClient.builder().build();

ContentStreamProvider contentToUpload = () -> new StringInputStream("Hello, World!");
HttpExecuteRequest uploadRequest = HttpExecuteRequest.builder()

HttpExecuteResponse response = httpClient.prepareRequest(uploadRequest).call();