Skip to content
AWS docs0.4

Spring Boot S3 Workshop

Latest stable Based on AWS release 0.4.0

A runnable workshop grounded in the 0.4.0 release source.

Expose S3 object operations through a small Spring Boot WebFlux controller while auto-configured operations own SDK details. The workshop adds listing, deletion, presigning, and optional client-side encryption to a basic upload/download path.

Use it when a Spring service needs S3 templates, presigned URLs, or envelope encryption and must understand which SDK modules and beans activate each feature.

This example is not published. Run ./gradlew :aws-spring-boot-s3-examples:test. Applications import the central BOM, bluetape4k-aws-spring-boot, and software.amazon.awssdk:s3; encrypted routes also need KMS support.

S3DocumentController delegates to S3Operations/S3CoroutinesTemplate. Optional S3ClientSideEncryptionOperations stores encrypted data with envelope metadata. Auto-configuration creates and closes service clients.

  1. Upload and download one object.
  2. List by prefix and delete the object.
  3. Generate presigned GET and PUT URLs and inspect their expiry.
  4. Enable the encrypted route with a deterministic test KMS implementation.
  5. Run AOT tasks after changing configuration or controller types.

SpringBootS3ExampleApplication starts the service and S3DocumentController exposes /s3/documents. It supports plain/encrypted upload and download, object listing, presigned URLs, and delete.

Keep bucket/key validation at the HTTP boundary and stream payloads when size is unbounded. Separate object naming, retention, encryption context, and authorization from the transport helper.

Spring creates the S3 client, presigner, templates, and optional encryption operations when their classes and properties are present. The controller does not own or close them.

Set region and optional endpoint override/path-style access for emulators. Configure presign duration. Encryption needs a key ID, stable encryption context, KmsOperations, and the AWS KMS runtime module.

Missing bucket, wrong addressing style, expired presigned URL, partial upload, absent KMS bean, mismatched encryption context, and oversized buffering are likely failures.

Measure latency, bytes, failures, retries, and presign counts without logging object content or signed query strings. Define multipart, retention, versioning, and partial-failure policy outside the controller.

S3DocumentControllerLocalStackTest selects the emulator, creates a bucket, and verifies upload, download, listing, presigned URLs, delete, and encryption using a deterministic KMS test double.

Compare the Ktor S3 workshop for direct SigV4 HTTP behavior, then add service-specific IAM, large-object transfer, and real KMS smoke tests.

The deterministic KMS helper does not prove AWS KMS permissions or ciphertext behavior. The example does not benchmark large transfers, multipart recovery, versioned deletion, or bucket policy.

These diagrams are loaded directly from README assets published with the 0.4.0 release and pinned to its immutable commit. They describe this manual’s released structure and runtime flows, not later Snapshot changes. Select a preview to open the SVG at the same release commit.

aws spring boot s3 examples Architecture diagram

Section titled “aws spring boot s3 examples Architecture diagram”

aws spring boot s3 examples Architecture diagram

Release README: examples/aws-spring-boot-s3-examples/README.md