Skip to content

ZERO-Z3 with Python (boto3)

boto3 needs the endpoint URL and the region name; everything else is standard S3.

Configure

import boto3

s3 = boto3.client(
    "s3",
    endpoint_url="https://fra.s3.zeroservices.eu",
    region_name="zero-fra2",
    aws_access_key_id="YOUR_ACCESS_KEY",
    aws_secret_access_key="YOUR_SECRET_KEY",
)

Regions: zero-fra1 (fra1.s3.zeroservices.eu), zero-fra2 (fra.s3.zeroservices.eu), zero-eyl1 (eyl1.s3.zeroservices.eu). Keys come from the customer portal.

Use

s3.list_objects_v2(Bucket="my-bucket")
s3.upload_file("local.txt", "my-bucket", "key")
s3.download_file("my-bucket", "key", "local.txt")

# Presigned download link, valid for one hour
url = s3.generate_presigned_url(
    "get_object",
    Params={"Bucket": "my-bucket", "Key": "key"},
    ExpiresIn=3600,
)

Large uploads

boto3 switches to multipart uploads automatically above the configured threshold. Incomplete multipart uploads keep occupying storage until aborted or expired by a lifecycle rule, see the billing model.

from boto3.s3.transfer import TransferConfig

cfg = TransferConfig(multipart_threshold=64 * 1024 * 1024, max_concurrency=8)
s3.upload_file("big.iso", "my-bucket", "big.iso", Config=cfg)

Your bucket already exists; it was created with your order. One account holds one bucket, see accounts and buckets.