| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
S3Mock is a lightweight server that implements a subset of the Amazon S3 API for local integration testing. It removes the need for real AWS infrastructure during development and testing.
Recommended usage: Run S3Mock as a Docker container or via Testcontainers to avoid classpath conflicts.
Get up and running in 30 seconds:
# 1. Start S3Mock
docker run -p 9090:9090 adobe/s3mock
# 2. Create a bucket
aws s3api create-bucket --bucket my-bucket --endpoint-url http://localhost:9090
# 3. Upload a file
aws s3api put-object --bucket my-bucket --key my-file --body ./my-file --endpoint-url http://localhost:9090
# 4. Download the file
aws s3api get-object --bucket my-bucket --key my-file --endpoint-url http://localhost:9090 output-fileFor programmatic testing, see Testcontainers or JUnit 5 Extension below.
| S3Mock | Status | Spring Boot | Kotlin | Java (target) | Java (compile) | AWS SDK v2 | Testcontainers |
|---|---|---|---|---|---|---|---|
| 5.x | Active | 4.0.x | 2.3 | 17 | 25 | 2.x | 2.x |
| 4.x | Deprecated | 3.x | 2.1-2.2 | 17 | 17 | 2.x | 1.x |
| 3.x | End of Life | 2.x | 1.x-2.0 | 17 | 17 | 2.x | 1.x |
| 2.x | End of Life | 2.x | - | 11 | 11 | 1.x/2.x | - |
| 1.x | End of Life | 2.x | - | 11 | 11 | 1.x/2.x | - |
For full details, see the Changelog.
See the complete operations table in the AWS documentation.
Click to expand operations table (operations marked ✅ are supported)S3Mock includes experimental support for the Amazon S3 Vectors API — a separate AWS API for storing and querying high-dimensional vector embeddings.
Enable with the vectors Spring profile. The Vectors API runs on dedicated ports (9092 HTTP, 9193 HTTPS) separate from the standard S3 ports.
Docker:
docker run -p 9090:9090 -p 9191:9191 -p 9092:9092 -p 9193:9193 \
-e SPRING_PROFILES_ACTIVE=vectors \
adobe/s3mockAWS SDK v2 (Kotlin):
val vectorsClient = S3VectorsClient.builder()
.endpointOverride(URI.create("http://localhost:9092"))
.region(Region.US_EAST_1)
.credentialsProvider(StaticCredentialsProvider.create(
AwsBasicCredentials.create("foo", "bar")
))
.build()
vectorsClient.createVectorBucket { it.vectorBucketName("my-vectors") }| Operation | Support |
|---|---|
| CreateVectorBucket | ✅ |
| GetVectorBucket | ✅ |
| ListVectorBuckets | ✅ |
| DeleteVectorBucket | ✅ |
| PutVectorBucketPolicy | ✅ |
| GetVectorBucketPolicy | ✅ |
| DeleteVectorBucketPolicy | ✅ |
| CreateIndex | ✅ |
| GetIndex | ✅ |
| ListIndexes | ✅ |
| DeleteIndex | ✅ |
| PutVectors | ✅ |
| GetVectors | ✅ |
| ListVectors | ✅ |
| DeleteVectors | ✅ |
| QueryVectors | ✅ |
| TagResource | ✅ |
| UntagResource | ✅ |
| ListTagsForResource | ✅ |
Vector-specific configuration:
| Variable | Default | Description |
|---|---|---|
| COM_ADOBE_TESTING_S3MOCK_VECTORS_HTTP_PORT | 9092 | HTTP port for the Vectors API |
| COM_ADOBE_TESTING_S3MOCK_VECTORS_HTTPS_PORT | 9193 | HTTPS port for the Vectors API |
Available on Docker Hub, the Docker image is the recommended way to run S3Mock.
Basic usage:
docker run -p 9090:9090 -p 9191:9191 adobe/s3mockPorts: 9090 (HTTP), 9191 (HTTPS)
With configuration:
docker run -p 9090:9090 -p 9191:9191 \
-e COM_ADOBE_TESTING_S3MOCK_STORE_INITIAL_BUCKETS=test-bucket \
-e SPRING_PROFILES_ACTIVE=debug \
adobe/s3mockDocker Compose:
services:
s3mock:
image: adobe/s3mock:latest
environment:
- COM_ADOBE_TESTING_S3MOCK_STORE_INITIAL_BUCKETS=bucket1,bucket2
ports:
- 9090:9090
- 9191:9191With persistent storage:
services:
s3mock:
image: adobe/s3mock:latest
environment:
- COM_ADOBE_TESTING_S3MOCK_STORE_ROOT=containers3root
- COM_ADOBE_TESTING_S3MOCK_STORE_RETAIN_FILES_ON_EXIT=true
ports:
- 9090:9090
volumes:
- ./locals3root:/containers3rootThe S3MockContainer provides a ready-to-use Testcontainers implementation.
Maven dependency:
<dependency>
<groupId>com.adobe.testing</groupId>
<artifactId>s3mock-testcontainers</artifactId>
<version>...</version>
<scope>test</scope>
</dependency>Usage example:
@Testcontainers
class MyTest {
@Container
val s3Mock = S3MockContainer("latest")
.withInitialBuckets("test-bucket")
@Test
fun test() {
val s3Client = S3Client.builder()
.endpointOverride(URI.create(s3Mock.httpEndpoint))
.region(Region.US_EAST_1)
.credentialsProvider(StaticCredentialsProvider.create(
AwsBasicCredentials.create("foo", "bar")
))
.build()
s3Client.createBucket { it.bucket("my-bucket") }
}
}To test the S3 Vectors API, call withVectors() to activate the vectors Spring profile and connect via s3Mock.vectorsHttpEndpoint / s3Mock.vectorsHttpsEndpoint (container ports 9092 / 9193):
@Container
val s3Mock = S3MockContainer("latest").withVectors()Note: This module may be removed in S3Mock 6.x. Consider using Testcontainers instead.
Maven dependency:
<dependency>
<groupId>com.adobe.testing</groupId>
<artifactId>s3mock-junit5</artifactId>
<version>...</version>
<scope>test</scope>
</dependency>Usage:
@ExtendWith(S3MockExtension::class)
class MyTest {
@Test
fun test(s3Client: S3Client) {
s3Client.createBucket { it.bucket("test-bucket") }
}
}See examples: Declarative | Programmatic
Note: This module may be removed in S3Mock 6.x. Consider using Testcontainers instead.
Maven dependency:
<dependency>
<groupId>com.adobe.testing</groupId>
<artifactId>s3mock-testng</artifactId>
<version>...</version>
<scope>test</scope>
</dependency>Configure in testng.xml - see example configuration.
Pass --endpoint-url to point the CLI at S3Mock, and add --no-verify-ssl for HTTPS:
# Create bucket
aws s3api create-bucket --bucket my-bucket --endpoint-url http://localhost:9090
# Upload object
aws s3api put-object --bucket my-bucket --key my-file --body ./my-file --endpoint-url http://localhost:9090
# Download object
aws s3api get-object --bucket my-bucket --key my-file --endpoint-url http://localhost:9090 output-file
# HTTPS
aws s3api get-object --bucket my-bucket --key my-file --no-verify-ssl --endpoint-url https://localhost:9191 output-file# Create bucket
curl -X PUT http://localhost:9090/my-bucket/
# Upload object
curl -X PUT --upload-file ./my-file http://localhost:9090/my-bucket/my-file
# Download object
curl http://localhost:9090/my-bucket/my-file -O
# HTTPS (with self-signed certificate)
curl --insecure https://localhost:9191/my-bucket/my-file -OConfigure S3Mock using environment variables:
| Variable | Default | Description |
|---|---|---|
| COM_ADOBE_TESTING_S3MOCK_STORE_ROOT | Java temp directory | Base directory for file storage |
| COM_ADOBE_TESTING_S3MOCK_STORE_REGION | us-east-1 | AWS region to mock |
| COM_ADOBE_TESTING_S3MOCK_STORE_INITIAL_BUCKETS | none | Comma-separated list of buckets to create on startup |
| COM_ADOBE_TESTING_S3MOCK_STORE_RETAIN_FILES_ON_EXIT | false | Keep files after shutdown |
| COM_ADOBE_TESTING_S3MOCK_STORE_VALID_KMS_KEYS | none | Comma-separated KMS key ARNs (validation only, no encryption) |
| COM_ADOBE_TESTING_S3MOCK_CONTROLLER_CONTEXT_PATH | "" | Base context path for all endpoints |
Activate profiles via the SPRING_PROFILES_ACTIVE environment variable:
| Profile | Description |
|---|---|
| debug | Debug-level logging for Spring Web, Apache, and request details. Also activates actuator. |
| trace | Trace-level logging for Spring Web, Apache, and request details. Also activates actuator. |
| actuator | Enables JMX and all Spring Boot Actuator endpoints (health, info, etc.). |
| vectors | Enables the S3 Vectors API on dedicated ports (9092 HTTP, 9193 HTTPS). |
Actuator endpoints are disabled by default. To enable them:
# Via debug or trace profile (also enables verbose logging)
docker run -p 9090:9090 -p 9191:9191 -e SPRING_PROFILES_ACTIVE=debug adobe/s3mock
# Via actuator profile only (no extra logging)
docker run -p 9090:9090 -p 9191:9191 -e SPRING_PROFILES_ACTIVE=actuator adobe/s3mock
# Via individual environment variables (without any profile)
docker run -p 9090:9090 -p 9191:9191 \
-e MANAGEMENT_ENDPOINTS_ACCESS_DEFAULT=unrestricted \
-e MANAGEMENT_ENDPOINTS_WEB_EXPOSURE_INCLUDE='*' \
adobe/s3mockS3Mock exposes two readiness endpoints:
/favicon.ico (always available)
Returns HTTP 200 OK with an empty body. This endpoint is always active, requires no configuration, and is used by Testcontainers and the integration test suite to detect readiness:
curl -sf http://localhost:9090/favicon.ico/actuator/health (requires actuator profile)
The standard Spring Boot health endpoint. Only available when the actuator profile (or debug/trace) is active:
# Start with actuator enabled
docker run -p 9090:9090 -p 9191:9191 -e SPRING_PROFILES_ACTIVE=actuator adobe/s3mock
# Check health
curl -sf http://localhost:9090/actuator/healthDocker Compose health check example:
services:
s3mock:
image: adobe/s3mock:latest
ports:
- 9090:9090
- 9191:9191
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://localhost:9090/favicon.ico"]
interval: 5s
retries: 3Port already in use (Address already in use)
Connection refused
SSL certificate errors
Docker not running (Testcontainers)
Classpath conflicts (JUnit 5 Extension / embedded mode)
AWS SDK endpoint configuration
Objects not found / wrong bucket
S3Mock stores data on disk with the following structure:
<root>/
<bucket-name>/
bucketMetadata.json # Bucket metadata
<object-uuid>/
binaryData # Object content
objectMetadata.json # Object metadata
<version-id>-binaryData # Versioned object (if versioning enabled)
<version-id>-objectMetadata.json
multiparts/
<upload-id>/
multipartMetadata.json
<part-number>.part
<part-number>.partmeta.json # per-part checksum + size; removed after CompleteMultipartUpload
Note: The file system structure is an implementation detail and may change between releases. While files can be inspected during runtime, reusing persisted data across restarts is not officially supported.
S3Mock is designed for testing, not production workloads:
graph LR
Client["AWS SDK / CLI / cURL"] -->|HTTP :9090 / HTTPS :9191| Controller
subgraph S3Mock
Controller["Controller<br/>(REST endpoints)"] -->|delegates| Service["Service<br/>(business logic)"]
Service -->|coordinates| Store["Store<br/>(persistence)"]
Store -->|read/write| FS["Filesystem"]
end
Module Documentation:
Requirements: Java 25, Maven 3.9+, Docker (for Docker build and integration tests)
Build:
make install # Full build with Docker
make skip-docker # Skip Docker buildRun from source:
make run # As Spring Boot application
# As Docker container
./mvnw clean package -pl server -am -DskipTests
docker run -p 9090:9090 -p 9191:9191 adobe/s3mock:latestRun integration tests:
make integration-testsTechnology:
Contributions are welcome! See Contributing Guide.
Governance: Project leads make final decisions — see developers in pom.xml.
Security: See Security Policy for reporting vulnerabilities. S3Mock uses GitHub Actions for SBOM generation and vulnerability scanning.
Licensed under the Apache License 2.0 - see LICENSE.
| Back | FazBrowse Home | New Git URL |