Skip to main content
This example demonstrates how to manage sandbox lifecycle automatically using auto-stop, auto-archive, and auto-delete intervals.

What You’ll Learn

  • Setting auto-archive intervals
  • Configuring auto-delete policies
  • Understanding lifecycle states
  • Creating sandboxes with custom intervals
  • Updating intervals on existing sandboxes
  • Best practices for cost optimization

Auto-Archive Examples

Auto-archive automatically archives inactive sandboxes to reduce storage costs while preserving their state.

Auto-Delete Examples

Auto-delete automatically removes sandboxes after they’ve been stopped for a specified period.

Expected Output

Auto-Archive

Auto-Delete

Key Concepts

Auto-Archive Intervals

Auto-archive helps reduce storage costs by archiving inactive sandboxes:
  • Default: 30 minutes of inactivity
  • 0: Never archive (sandbox stays active)
  • Positive number: Minutes of inactivity before archiving
  • Effect: Archived sandboxes consume minimal storage

Auto-Delete Intervals

Auto-delete permanently removes sandboxes after being stopped:
  • Default: -1 (disabled)
  • -1: Disabled (sandbox never auto-deletes)
  • 0: Delete immediately when stopped
  • Positive number: Minutes after stop before deletion
  • Effect: Sandbox and all data are permanently removed
Permanent deletion: Auto-delete permanently removes the sandbox and all its data. Use with caution!

Lifecycle States

Sandboxes transition through these states:
  • running: Sandbox is active and consuming compute resources
  • stopped: Sandbox is paused, only storage costs apply
  • archived: Sandbox is compressed, minimal storage costs
  • deleted: Sandbox is permanently removed

Common Configurations

Development Sandboxes

Production Sandboxes

Demo/Testing Sandboxes

CI/CD Sandboxes

Cost Optimization

Understanding Costs

Optimization Strategies

Development workflows: Set auto_archive_interval=30 to quickly archive idle dev sandboxes while keeping them recoverable.
CI/CD pipelines: Use auto_delete_interval=0 to immediately clean up test environments after job completion.
Long-running services: Set auto_archive_interval=0 and auto_delete_interval=-1 to prevent disruption.

Best Practices

1. Match Intervals to Use Case

2. Update Intervals Dynamically

3. Monitor Sandbox State

4. Label for Tracking

Interval Recommendations

By Use Case

By Team Size

  • Individual developers: 30 min archive, 24 hour delete
  • Small teams: 60 min archive, 48 hour delete
  • Large organizations: Custom per project, use labels

Troubleshooting

Sandbox Deleted Unexpectedly

Archive Taking Too Long

Disable All Auto-Cleanup

Next Steps

Basic Sandbox

Learn sandbox fundamentals

File Operations

Work with files in sandboxes