AWS S3 & SpringBoot

Upload files to Amazon S3 via AWS SDK for Java 2.x using SpringBoot

Getting Started

Follow the below instructions to get started with the source code:

Requirements

Dependencies

  • AWS Java SDK Amazon S3:
<dependencies>
  <dependency>
    <groupId>software.amazon.awssdk</groupId>
    <artifactId>s3</artifactId>
  </dependency>
</dependencies>

<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>software.amazon.awssdk</groupId>
      <artifactId>bom</artifactId>
      <version>2.17.124</version>
      <type>pom</type>
      <scope>import</scope>
    </dependency>
  </dependencies>
</dependencyManagement>

Configure storage properties

amazon.s3.bucket-name = ${AMAZON_S3_BUCKET_NAME}
amazon.s3.region = ${AWS_DEFAULT_REGION}
amazon.aws.credentials.access-key = ${AWS_ACCESS_KEY_ID}
amazon.aws.credentials.secret-access-key = ${AWS_SECRET_ACCESS_KEY}

In case of yaml

spring:
  profiles:
    active: ${CONFIG_PROFILE:uat}