Get URL(link) of a public S3 object programmatically
amazon-s3, amazon-web-services, java
Solution
For Java SDK 2
s3Client.utilities().getUrl(builder -> builder.bucket(AWS_BUCKET).key(s3RelativeFilePath)).toExternalForm();
Reference - https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/services/s3/S3Utilities.html#getUrl-java.util.function.Consumer-
older versions had:
s3Client.getResourceUrl(bucket, s3RelativeToBucketPath);
Problem
I am storing one public object in AWS S3 bucket using given java API in my server Now i need to return back the public URL of the S3 object to my client Till now i have'nt found any API call that can return the public URL(or link field) of a S3 object Is there any way to get the URL??