Managing Resource Allocation for Sandboxes

Last updated: June 26, 2025

Daytona allows customizing resource allocation for sandboxes to efficiently manage usage and optimize costs based on specific requirements.

Adjustable Sandbox Resources

You can configure your sandboxes with custom resources:

  • vCPU: Set integer values between 1 and 4 CPU cores.

  • Memory: Set integer values between 1 and 8 GB.

  • Storage: Set integer values between 1 and 10 GB.

This flexibility enables efficient resource management tailored to your sandbox workloads.

Example Usage

If a sandbox doesn't require maximum resources, consider lowering allocations:

  • Example: For minimal tasks, configure storage to 1GB instead of the default 3GB, allowing more efficient utilization of your total available resources.

How to Configure

(Python) Use the Daytona SDK to specify custom resource values:

from daytona import Daytona, Resources, CreateSandboxFromImageParams, Image

daytona = Daytona()

# Custom resources example

resources = Resources(
    cpu=2,        # vCPU (1-4)
    memory=4,     # Memory in GB (1-8)
    disk=5        # Storage in GB (1-10)
)

params = CreateSandboxFromImageParams(
    image=Image.debian_slim("3.12"),
    resources=resources
)

sandbox = daytona.create(params)

Auto-Archive Sandboxes

Auto-archiving frees up all quota (CPU, memory, and disk).
By default, sandboxes are auto-archived 7 days after being stopped. You can override this interval:

Typescript Snippet

const sandbox = await daytona.create({
    snapshot: "my-snapshot-name",
    autoArchiveInterval: 60 // Auto-archive after a Sandbox has been stopped for 1 hour
});
  • Set to 0 to use the max of 30 days

  • Use this to keep your quota clean without manual cleanup

Additional Resources

For more detailed configuration options, refer to our Sandbox Resources documentation and specifically Auto-Archive Docs.