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??
Advertisement
Answer
For Java SDK 2
s3Client.utilities().getUrl(builder -> builder.bucket(AWS_BUCKET).key(s3RelativeFilePath)).toExternalForm();
older versions had:
s3Client.getResourceUrl(bucket, s3RelativeToBucketPath);