Amazon S3 – SpringBoot RestAPIs List All Files in S3 Bucket

In the tutorial, we build a SpringBoot RestAPIs to list all files in a Amazon S3 bucket.

Previous post:
Amazon S3 – SpringBoot RestAPIs Upload/Download File/Image to S3


  • Java 8
  • Maven 3.6.1
  • pring Tool Suite: 3.9.4.RELEASE
  • Spring Boot: 2.0.4.RELEASE
  • Amazon S3

S3 List Files in Bucket

The below segment code for List ALL file in S3 Bucket:

-> If you just want to list all files in a specific S3 folder, you can configure such as:


We re-use all the sourcecode of the previous tutorial:

-> Amazon S3 – SpringBoot RestAPIs Upload/Download File/Image to S3

springboot-restapi-amazon-s3-list-all-file + project-structure

What we build more? ->

  • Implement listFiles service
  • Expose listAllFiles RestAPI
Implement S3 listFiles service

– Add listFiles function in interface:

– Implement listFiles in

Expose List Files RestAPI

In, expose a new API -> @GetMapping("/api/files")

Run & Check results

Build and Run the SpringBoot sourcecode with commandlines {mvn clean install, mvn spring-boot:run}.

– All Files in Amazon S3:

springboot-restapi-amazon-s3-list-all-file + s3 files

– List all files with RestAPI:

springboot-restapi-amazon-s3-list-all-file + list-files


– In file, change & to yours.

– Sourcecode ->


By grokonez | August 5, 2018.

Related Posts

Got Something To Say:

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