Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.mirage.strukto.ai/llms.txt

Use this file to discover all available pages before exploring further.

Dependencies

uv sync --extra s3
R2 uses the same aiobotocore dependency as S3 (R2 is S3-compatible). For credential setup, see the R2 Setup guide.

Configuration

import os
from mirage import Workspace, MountMode
from mirage.resource.r2 import R2Config, R2Resource

config = R2Config(
    bucket=os.environ["R2_BUCKET"],
    account_id=os.environ["R2_ACCOUNT_ID"],
    access_key_id=os.environ["R2_ACCESS_KEY_ID"],
    secret_access_key=os.environ["R2_SECRET_ACCESS_KEY"],
)
resource = R2Resource(config)
ws = Workspace({"/r2/": resource}, mode=MountMode.READ)

Config Reference

FieldRequiredDefaultDescription
bucketYesR2 bucket name
account_idNoNoneCloudflare account ID (used to derive endpoint)
endpoint_urlNoNoneCustom endpoint (overrides account_id)
access_key_idNoNoneR2 API token access key
secret_access_keyNoNoneR2 API token secret key
aws_profileNoNoneAWS CLI profile name
regionNo"auto"Region
timeoutNo30Request timeout in seconds
proxyNoNoneHTTP proxy URL
Either account_id or endpoint_url must be provided. The endpoint is derived as https://{account_id}.r2.cloudflarestorage.com.