A lightweight, FastAPI-based S3-compatible server for local development and testing
Project description
Local S3 Server
A lightweight, FastAPI-based S3-compatible server designed for local development and testing. Perfect for developing and testing S3-dependent applications without connecting to actual AWS services.
Features
- S3-compatible API implementation
- Local storage for S3 buckets and objects
- FastAPI-powered for modern async support
- Simple configuration and setup
- Perfect for testing and development environments
- No AWS account required
Installation
pip install local-s3-server
Quick Start
- Create a fake credentials file (
fake_credentials):
AWSAccessKeyId=12345
AWSSecretKey=12345
- Set the credentials environment variable:
export AWS_CREDENTIAL_FILE="path/to/fake_credentials"
- Start the server:
python -m locals3server
- Use with any S3 client by pointing to the local endpoint:
import boto3
s3 = boto3.client('s3',
endpoint_url='http://localhost:10001',
aws_access_key_id='12345',
aws_secret_access_key='12345'
)
Configuration
The server can be configured using environment variables:
LOCAL_S3_HOST: Host to bind (default: localhost)LOCAL_S3_PORT: Port to listen on (default: 10001)LOCAL_S3_STORAGE: Storage directory (default: ~/.local-s3-server)
Examples
The examples directory contains sample code for common operations:
- Creating buckets and objects
- Uploading and downloading files
- Listing buckets and objects
- Deleting objects
- Working with nested paths
- Image handling
See the examples directory for complete examples.
Development
To set up the development environment:
git clone https://github.com/yourusername/local-s3-server.git
cd local-s3-server
pip install -e ".[dev]"
pytest
Attribution
This project is a modernized fork of PyS3Local, which itself was derived from mock-s3 (a Python port of Fake-S3). The codebase has been significantly enhanced with FastAPI integration and modern Python practices.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file local_s3_server-0.2.0.tar.gz.
File metadata
- Download URL: local_s3_server-0.2.0.tar.gz
- Upload date:
- Size: 10.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
24f97476a6d5a3a5fc14256c89322c7f1753ad68b0bc44cc7b9e868ae329489d
|
|
| MD5 |
fe222b44fd639b556dbd345daa034717
|
|
| BLAKE2b-256 |
d5d06d61e1cf22dc7247745b5994877a02c8e78ac38aec63d0446c49fc437336
|
File details
Details for the file local_s3_server-0.2.0-py3-none-any.whl.
File metadata
- Download URL: local_s3_server-0.2.0-py3-none-any.whl
- Upload date:
- Size: 13.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21617c240fa73ec618c9bee26a4746fefb0c94f5d9992d269e10719dee8b25a2
|
|
| MD5 |
6bc95fffc8264f7b872181aeca14369d
|
|
| BLAKE2b-256 |
bc8fc0501341e6eef136f6d15448f8e846f3281ddaff3e81acc30299705fd67c
|