AWS S3 Storage (Java)

Generates secure AS3 pre-signed URLs for browser uploads and downloads with C++ type validation.

1|Updated May 2, 2026
One-click install
npx skills add https://github.com/Levironexe/architect --skill aws-s3-storage-java
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: AWS S3 Storage (Java)
Source: https://github.com/Levironexe/architect/tree/main/skills/patterns/s3-java
Command: npx skills add https://github.com/Levironexe/architect --skill aws-s3-storage-java

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Prevents unsafe, server-mediated file uploads and fragile URL/key handling by providing a secure S3 storage pattern that uses pre-signed browser uploads, stores only object keys, and generates signed downloads on demand.

Core Features & Use Cases

  • Presigned direct uploads & downloads: Generates pre-signed PUT URLs for client uploads and pre-signed GET URLs for controlled retrieval, with MIME allowlisting before signing to reduce abuse.
  • Key-first storage strategy: Saves the S3 object key (e.g. uploads/uuid.ext) in your database and creates signed URLs when serving, enabling bucket/CDN changes without data migrations.
  • Secure upload confirmation + testability: Requires a post-upload confirmation endpoint that validates object existence in S3 (e.g. HeadObjectRequest) before persisting the key, and supports unit tests by mocking S3Client/S3Presigner.

Quick Start

Ask your AI agent to implement services/StorageService.java and config/S3Config.java for S3 presigning and to add an upload confirmation controller that validates the uploaded object in S3 before saving the object key to your database.

Frequently Asked Questions about AWS S3 Storage (Java)

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate pre-signed URLs for secure S3 browser uploads in Java?

To generate pre-signed URLs for secure S3 browser uploads in Java, configure an S3Presigner singleton and create a pre-signed PUT URL. You must apply server-side MIME allowlisting before signing to prevent malicious file uploads.

Should I store the full S3 URL or just the object key in my database?

You should store only the S3 object key, such as uploads/uuid.ext, in your database. This key-first storage strategy enables bucket or CDN changes later without requiring data migrations, generating signed URLs on demand.

How do I validate that a file was actually uploaded to S3 before saving the record?

To validate a file was uploaded to S3, implement a post-upload confirmation endpoint that checks object existence using a HeadObjectRequest. Only after confirming the object exists in S3 should you persist the object key to your database.

How do I unit test Java S3 pre-signed URL logic without making real AWS calls?

You can unit test Java S3 pre-signed URL logic by mocking the S3Client and S3Presigner instances using Mockito. This approach avoids real S3 calls while validating your MIME allowlisting and key generation logic.

Does this S3 pre-signed URL approach work with Spring backend APIs?

Yes, this S3 pre-signed URL approach works with production Spring backend APIs. It requires S3Client and S3Presigner singleton configuration sourced from environment variables or IAM roles to manage secure uploads and downloads.

What is the best way to prevent malicious file uploads when using pre-signed S3 URLs?

The best way to prevent malicious file uploads with pre-signed S3 URLs is enforcing server-side MIME allowlisting before signing. This validation ensures only approved file types are accepted for direct browser uploads.