Documentation Index
Fetch the complete documentation index at: https://mintlify.com/daytonaio/daytona/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Daytona supports multi-region deployment, allowing you to create sandboxes in different geographical locations. This enables you to:
- Reduce latency by placing sandboxes close to your users or data
- Comply with data residency requirements
- Distribute workloads across regions for better availability
Region Selection
Specify Target Region
When creating a sandbox, you can specify the target region:
import { Daytona } from '@daytonaio/sdk'
// Configure Daytona with a default region
const daytona = new Daytona({
apiKey: 'your-api-key',
target: 'us-east' // Default region for all sandboxes
})
// Create sandbox in the default region
const sandbox = await daytona.create()
console.log(`Sandbox region: ${sandbox.target}`)
Environment Variable Configuration
Set the default region using environment variables:
export DAYTONA_API_KEY="your-api-key"
export DAYTONA_TARGET="us-east"
Then use the SDK without explicit configuration:
import { Daytona } from '@daytonaio/sdk'
// Uses DAYTONA_TARGET from environment
const daytona = new Daytona()
const sandbox = await daytona.create()
Multi-Region Deployment
Deploy to Multiple Regions
Create sandboxes in different regions for the same application:
import { Daytona } from '@daytonaio/sdk'
// Create Daytona clients for different regions
const daytonaUSEast = new Daytona({ target: 'us-east' })
const daytonaEUWest = new Daytona({ target: 'eu-west' })
const daytonaAPSouth = new Daytona({ target: 'ap-south' })
// Deploy to multiple regions
const usEastSandbox = await daytonaUSEast.create({
labels: { region: 'us-east', app: 'api' }
})
const euWestSandbox = await daytonaEUWest.create({
labels: { region: 'eu-west', app: 'api' }
})
const apSouthSandbox = await daytonaAPSouth.create({
labels: { region: 'ap-south', app: 'api' }
})
console.log('Multi-region deployment complete')
Check Sandbox Region
Every sandbox has a target property indicating its region:
const sandbox = await daytona.get('sandbox-id')
console.log(`Sandbox ID: ${sandbox.id}`)
console.log(`Region: ${sandbox.target}`)
console.log(`Organization: ${sandbox.organizationId}`)
List Sandboxes by Region
// List all sandboxes in a specific region
const usEastDaytona = new Daytona({ target: 'us-east' })
const result = await usEastDaytona.list()
console.log(`Sandboxes in us-east: ${result.total}`)
for (const sandbox of result.items) {
console.log(` ${sandbox.id} - ${sandbox.target}`)
}
Region-Specific Use Cases
Data Residency Compliance
Ensure data stays within a specific region:
// Create sandbox in EU region for GDPR compliance
const euDaytona = new Daytona({
target: 'eu-west'
})
const gdprSandbox = await euDaytona.create({
labels: {
compliance: 'gdpr',
data_region: 'eu'
}
})
console.log(`GDPR-compliant sandbox in: ${gdprSandbox.target}`)
Low-Latency Access
Create sandboxes close to your users or data sources:
// Create sandbox near user location
const getUserRegion = (userLocation: string): string => {
const regionMap: Record<string, string> = {
'north-america': 'us-east',
'europe': 'eu-west',
'asia': 'ap-south'
}
return regionMap[userLocation] || 'us-east'
}
const userLocation = 'europe'
const region = getUserRegion(userLocation)
const daytona = new Daytona({ target: region })
const sandbox = await daytona.create({
labels: {
user_region: userLocation
}
})
console.log(`Created sandbox in ${sandbox.target} for ${userLocation}`)
Multi-Region Testing
Test applications across different regions:
const regions = ['us-east', 'eu-west', 'ap-south']
const sandboxes = []
for (const region of regions) {
const daytona = new Daytona({ target: region })
const sandbox = await daytona.create({
snapshot: 'test-environment',
labels: {
test_id: 'multi-region-test',
region: region
}
})
sandboxes.push(sandbox)
console.log(`Test sandbox created in ${region}`)
}
console.log(`Created ${sandboxes.length} test sandboxes`)
Region Configuration
Available Regions
Region availability depends on your organization’s configuration. Common regions include:
us-east - US East Coast
us-west - US West Coast
eu-west - Europe West
eu-central - Europe Central
ap-south - Asia Pacific South
ap-northeast - Asia Pacific Northeast
Contact your organization administrator for the list of available regions.
Default Region
If no region is specified:
- The client uses the region from
DAYTONA_TARGET environment variable
- If not set, uses your organization’s default region
Snapshots and Regions
Snapshots are region-specific. When creating a snapshot, it’s stored in the specified region:
const usEastDaytona = new Daytona({ target: 'us-east' })
// Create snapshot in us-east region
await usEastDaytona.snapshot.create(
{
name: 'my-snapshot',
image: Image.debianSlim('3.12')
},
{ onLogs: console.log }
)
// Use snapshot in the same region
const sandbox = await usEastDaytona.create({
snapshot: 'my-snapshot'
})
console.log(`Sandbox and snapshot in: ${sandbox.target}`)
Resource Quotas
Resource availability and quotas may vary by region. Your organization may have:
- Different resource limits per region
- Different available machine types per region
- Region-specific pricing
Best Practices
-
Choose the right region: Select regions based on user location, data location, and compliance requirements.
-
Use consistent regions: Keep related sandboxes (e.g., frontend and backend) in the same region for low latency.
-
Label by region: Use labels to track which region each sandbox belongs to.
-
Plan for snapshots: Remember that snapshots are region-specific and plan accordingly.
-
Monitor costs: Different regions may have different pricing structures.
-
Test multi-region: If deploying globally, test your application in all target regions.
-
Consider data transfer: Moving large amounts of data between regions can be slow and costly.
Region Configuration Reference
DaytonaConfig
interface DaytonaConfig {
apiKey?: string
apiUrl?: string
target?: string // Region identifier
}
Environment Variables
| Variable | Description | Example |
|---|
DAYTONA_TARGET | Default region for sandboxes | us-east |
DAYTONA_API_URL | API endpoint URL | https://app.daytona.io/api |
DAYTONA_API_KEY | API authentication key | your-api-key |