Download file from the AWS S3 Bucket

#add dependency in pom.xml
<dependency>
    <groupId>commons-io</groupId>
    <artifactId>commons-io</artifactId>
    <version>2.5</version>
</dependency>
S3Object s3Object=s3client.getObject(bucketName,"S3ImagePath");
S3ObjectInputStream inputStream=s3Object.getObjectContent();
//import org.apache.commons.io.FileUtils use this one
FileUtils.copyInputStreamToFile(inputStream, new File("whereyouwanttosave"));

Raman

Related post

Leave a Reply

Your email address will not be published. Required fields are marked *