DaytonaDocs

ObjectStoreService

Connect S3 buckets and mount them into sandboxes.

ObjectStoreService manages object stores: named references to your own S3-compatible buckets (AWS S3, MinIO/Ceph, Cloudflare R2, ...). Credentials are project secrets referenced by name — create them first with daytona.secret.set(). A store can be mounted into a sandbox at creation (via object_store_mounts) or at runtime (via mount()); the sandbox sees the bucket as a FUSE filesystem. Obtain the service as daytona.object_store. See the object stores guide.

create()

Creates an object store referencing a bucket and its credential secrets. The store is ready immediately.

Python
def create(
    name: str,
    bucket: str,
    access_key_secret: str,
    secret_key_secret: str,
    *,
    endpoint: str | None = None,
    region: str | None = None,
    prefix: str | None = None,
    path_style: bool = False,
    read_only: bool = False,
    provider: str | None = None,
    session_token_secret: str | None = None,
) -> Dict[str, Any]
ParameterTypeDefaultDescription
namestrStore name (unique within the project).
bucketstrBucket name.
access_key_secretstrName of the project secret holding the access key — not the value.
secret_key_secretstrName of the project secret holding the secret key.
endpointstrNoneCustom S3 endpoint (MinIO, R2, ...).
regionstrNoneBucket region.
prefixstrNoneKey prefix to scope the mount to.
path_styleboolFalseUse path-style addressing (typical for MinIO/Ceph).
read_onlyboolFalseDefault mounts to read-only.
providerstrNoneProvider hint, e.g. "AWS", "Minio", "Cloudflare".
session_token_secretstrNoneName of a secret holding a session token, for temporary credentials.

Returns: the object-store dict (id, name, bucket, state, ...; credential fields expose only secret names, never values).

Note: The directory-listing cache TTL (dir_cache_secs) can currently only be set through the REST API — it is not exposed in the SDKs yet.

Python
daytona.secret.set("s3-access-key", "AKIA...")
daytona.secret.set("s3-secret-key", "...")
 
store = daytona.object_store.create(
    "training-data",
    bucket="acme-training-data",
    access_key_secret="s3-access-key",
    secret_key_secret="s3-secret-key",
    region="us-east-1",
)

get()

Fetches an object store by id or name.

Python
def get(name_or_id: str) -> Dict[str, Any]

Raises: DaytonaNotFoundError if it does not exist.

list()

Lists the project's object stores. Deleted stores are excluded unless include_deleted=True.

Python
def list(include_deleted: bool = False) -> List[Dict[str, Any]]

delete()

Deletes an object store. Accepts a store dict (its id is used) or a plain id/name string. Fails with a conflict while a live sandbox has it mounted.

Python
def delete(object_store: Any) -> None

Raises: DaytonaConflictError if the store is mounted by a live sandbox.

Runtime mounts

Mount and unmount stores on a running sandbox without recreating it. See mounting object stores.

mount()

Mounts an object store into a running sandbox at mount_path.

Python
def mount(
    sandbox_id: str,
    object_store: str,
    mount_path: str,
    read_only: bool | None = None,
) -> Dict[str, Any]
ParameterTypeDefaultDescription
sandbox_idstrTarget sandbox id.
object_storestrStore id or name.
mount_pathstrAbsolute in-sandbox mount path.
read_onlyboolNoneOverride the store's default read-only for this mount.
Python
daytona.object_store.mount(sandbox.id, "training-data", "/mnt/data", read_only=True)

unmount()

Unmounts a mount by name from a running sandbox.

Python
def unmount(sandbox_id: str, name: str) -> None

list_mounts()

Lists a sandbox's current object-store mounts.

Python
def list_mounts(sandbox_id: str) -> Any

Returns: the list of mount records.

Mounting at creation: ObjectStoreMount

Attach stores at sandbox creation with the ObjectStoreMount dataclass in CreateSandbox*Params.object_store_mounts:

Python
from rlp import CreateSandboxFromImageParams, ObjectStoreMount
 
sandbox = daytona.create(CreateSandboxFromImageParams(
    image="python:3.12-slim",
    object_store_mounts=[ObjectStoreMount(object_store="training-data", mount_path="/mnt/data")],
))
FieldTypeDefaultDescription
object_storestrStore id or name (resolved server-side).
mount_pathstrAbsolute in-sandbox mount path.
read_onlyboolNoneOverride the store's default read-only for this mount.

On this page