Enderchest
Documentation · boto3 (Python)

boto3 with Enderchest

boto3 works against Enderchest with an endpoint_url and path-style addressing. The examples below cover the calls a backup or archive script needs.

Endpoint https://s3.enderchest.store · region eu-ams-1 · path-style addressing · an access key from the console. 50 GB free on every account, then $3 per TB per month; downloads and API requests are free.

Pass the endpoint and force path-style addressing. Everything else is standard boto3.

import boto3
from botocore.config import Config

s3 = boto3.client(
    "s3",
    endpoint_url="https://s3.enderchest.store",
    region_name="eu-ams-1",
    aws_access_key_id="YOUR_ACCESS_KEY_ID",
    aws_secret_access_key="YOUR_SECRET_ACCESS_KEY",
    config=Config(s3={"addressing_style": "path"}, signature_version="s3v4"),
)

s3.create_bucket(Bucket="datasets")
s3.upload_file("train.parquet", "datasets", "v1/train.parquet")

for page in s3.get_paginator("list_objects_v2").paginate(Bucket="datasets", Prefix="v1/"):
    for obj in page.get("Contents", []):
        print(obj["Key"], obj["Size"])

s3.download_file("datasets", "v1/train.parquet", "train.copy.parquet")

url = s3.generate_presigned_url(
    "get_object",
    Params={"Bucket": "datasets", "Key": "v1/train.parquet"},
    ExpiresIn=3600,
)
print(url)

upload_file switches to multipart automatically above 8 MB and uploads parts in parallel. Presigned URLs are valid for up to 7 days and work for get_object and put_object.

Other clients

Every supported operation is listed in the documentation. Questions: [email protected].