S3-Compatible Gateway
blobgw-s3 puts an S3-compatible front end on the object gateway. Standard S3 clients such as the AWS CLI, boto3, and aws-sdk-go-v2 get content-defined deduplication and content-type compression on the server side. The gateway maps each bucket to a dedup domain and each object key to a gateway ref.
Supported operations
| Area | Operations |
|---|---|
| Service | ListBuckets (GET /) |
| Buckets | CreateBucket, HeadBucket, DeleteBucket (only when empty), ListObjectsV2 (prefix, delimiter, continuation-token, start-after, max-keys, encoding-type=url), and a minimal marker-based ListObjects v1 |
| Objects | PutObject, GetObject (including Range requests with 206 and 416), HeadObject, DeleteObject |
| Multipart | CreateMultipartUpload, UploadPart, CompleteMultipartUpload, AbortMultipartUpload, ListParts, ListMultipartUploads |
| Metadata | x-amz-meta-* user metadata and the object ETag are stored durably in the object’s manifest. Multipart objects get the standard composite multipart ETag. |
Addressing is path-style only (http://host:port/bucket/key). Anything not listed above, including query-string presigned URLs, isn’t supported by this release.
Authentication
Requests must be signed with AWS Signature Version 4 in the Authorization header. Three payload modes are accepted:
- a signed single-chunk payload (hex SHA-256 in
x-amz-content-sha256) UNSIGNED-PAYLOADSTREAMING-AWS4-HMAC-SHA256-PAYLOAD(aws-chunked, where the signature of each chunk is verified)
Trailing-checksum modes such as STREAMING-UNSIGNED-PAYLOAD-TRAILER are not on this list. Recent AWS SDK and CLI versions can use those modes by default. If uploads fail with a content-SHA256 mismatch, set AWS_REQUEST_CHECKSUM_CALCULATION=when_required in the environment, or request_checksum_calculation="when_required" in botocore’s Config.
X-Amz-Date must be within 15 minutes of the server clock. The region isn’t enforced: the gateway uses the credential scope’s region from the request, so us-east-1 works.
Credentials come from a JSON file that maps each access key to a secret and a dedup domain:
{ "credentials": [ {"access_key_id": "AKIAEXAMPLEA", "secret_key": "change-me-a", "domain": "tenant-a"}, {"access_key_id": "AKIAEXAMPLEB", "secret_key": "change-me-b", "domain": "tenant-b"} ]}Every entry needs all three fields, and access keys must be unique.
Buckets and domains
Buckets are explicit. A client must run CreateBucket before any object operation. Operations on a bucket that was never created return NoSuchBucket.
A bucket is pinned to the dedup domain of the credential that created it. Object keys map directly to refs within that domain, so buckets created by credentials for the same domain share one key namespace. Use one bucket per domain.
Running
cd blobgw-s3go run ./cmd/blobgw-s3 -listen :8095 -data-dir ./blobgw-s3-data \ -credentials ./credentials.json| Flag | Default | Purpose |
|---|---|---|
-listen | :8095 | HTTP listen address |
-data-dir | ./blobgw-s3-data | Local casstore directory (manifests and chunks) |
-credentials | $BLOBGW_S3_CREDENTIALS | Credentials JSON file (required) |
-compression | zstd | Pack compression for compressible content: zstd, gzip, or none |
-pack-framing | per-chunk | per-chunk (range-readable) or whole-pack |
-pack-size | 0 | Pack target in bytes (0 = about 16 MiB) |
-max-object-size | 0 | PutObject body ceiling (0 = unlimited) |
-gc-interval / -gc-safety-window | 10m / 1h | Scheduled chunk GC (0 disables) and the minimum age before reclaim |
-registry-backend | memory | memory, or jetstream for bucket, credential, and in-flight multipart registries in NATS JetStream KV that survive restarts |
-nats-url | NATS default | NATS server used with -registry-backend=jetstream |
-bucket-kv, -credential-kv, -mpu-kv | built-in names | JetStream KV bucket names |
With the default memory registry, buckets and in-flight multipart uploads are lost on restart. With jetstream, the credentials file is upserted into KV at every start.
The container image is ghcr.io/scitrera/blobgw-s3.
Client examples
AWS CLI
export AWS_ACCESS_KEY_ID=AKIAEXAMPLEAexport AWS_SECRET_ACCESS_KEY=change-me-aexport AWS_DEFAULT_REGION=us-east-1export AWS_REQUEST_CHECKSUM_CALCULATION=when_requiredEP=http://127.0.0.1:8095
aws --endpoint-url $EP s3api create-bucket --bucket modelsaws --endpoint-url $EP s3 cp ./checkpoint.safetensors s3://models/run-1/checkpoint.safetensorsaws --endpoint-url $EP s3 ls s3://models/run-1/Large files uploaded with aws s3 cp use multipart upload automatically.
boto3
import boto3from botocore.config import Config
s3 = boto3.client( "s3", endpoint_url="http://127.0.0.1:8095", aws_access_key_id="AKIAEXAMPLEA", aws_secret_access_key="change-me-a", region_name="us-east-1", config=Config( s3={"addressing_style": "path"}, request_checksum_calculation="when_required", ),)
s3.create_bucket(Bucket="models")s3.put_object(Bucket="models", Key="notes/a.txt", Body=b"hello", ContentType="text/plain")print(s3.get_object(Bucket="models", Key="notes/a.txt", Range="bytes=0-1")["Body"].read())for obj in s3.list_objects_v2(Bucket="models", Prefix="notes/").get("Contents", []): print(obj["Key"], obj["Size"])The Content-Type you send decides compression. For example, application/x-safetensors and image/* are stored uncompressed. See How deduplication and compression work.