An open-source, faster Devin alternative
Multi-cloud architecture
OpenSandbox is built so a cell can run on any IaaS that gives us VMs + S3-compatible blob storage. Today we run cells on Azure (production + dev1 + dev2) and have a complete AWS implementation ready for a third cell. This doc explains the abstraction boundary so adding a new cloud is a checklist, not a rewrite.
What's cloud-specific
Three things, and only three:
internal/compute/{cloud}.go— implementscompute.Pool. Knows how to launch / destroy / drain / list VMs in that cloud. Builds the cloud-init / user-data script usingcompute.BuildWorkerEnv(spec)plus provider-specific bring-up (NVMe RAID, AMI metadata fetches, etc.).deploy/{cloud}/— provisioning scripts for VPC/VNet, control plane VM, first worker VM, S3-compatible bucket, IAM/managed identity. Onecreate-{cloud}-{cell}.shper cell.deploy/packer/worker-ami-{cloud}.pkr.hcl— Packer template for the worker VM image. Same Go binaries, different baking.
Optional but useful per-cloud:
internal/secrets/{backend}.go— runtime secrets backend. KeyVault for Azure, SecretsManager for AWS. Falls back toEnvBackendif unset.
What's cloud-neutral
Everything else:
internal/api/,internal/auth/,internal/billing/,internal/controlplane/,internal/qemu/,internal/sandbox/,internal/storage/,internal/db/— no cloud SDK imports anywhere.cmd/server/main.goselects a pool viacfg.ComputeProviderand hands it a cloud-neutralcompute.WorkerSpec. The pool fills in cloud-specific bits.- All Cloudflare Workers, D1 schema, R2 buckets — global, by definition.
- Postgres, Redis — standard protocols, work on any managed offering.
- Storage layer uses S3 SDK with custom endpoints — Azure Blob, AWS S3, GCS, R2, MinIO all work without code changes.
Cell ID format
{cloud}-{region}-{slot}, with region in AWS-style hyphenated form for
every cloud (Azure's westus2 normalizes to us-west-2, eastus2 to
us-east-2, etc.). One parse for all clouds — no per-cloud lookup table.
The slot is a/b/c/... distinguishing multiple cells in the same region.
Examples:
azure-us-east-2-a(production)azure-us-west-2-b(dev2)aws-us-east-1-a(dev3)gcp-us-central-1-a(future)
Cell ID is the only routing identity. Workers, events, sandboxes, all
namespaced by cell_id everywhere. The Azure-native region name (e.g.
westus2) is only used as the --location for az CLI calls during
provisioning; the cell registry, capability tokens, and event envelopes
see only the normalized form.
Adding a new cloud (checklist)
To stand up a GCP cell tomorrow:
Implement Pool: write
internal/compute/gcp.gomirroringazure.go/ec2.go. About 400 LOC. Required methods are in thecompute.Poolinterface inpool.go. Implementcompute.WorkerSpecHolderso the CP can inject the cloud-neutralWorkerSpec. Return acompute.Machinewith internal/public addresses populated.Add config: in
internal/config/config.go, add a newGCPxxxfield block (subscription/project equivalents) and add"gcp"to the switch incmd/server/main.go.Provisioning script:
deploy/gcp/create-gcp-{cellname}.sh, mirroringdeploy/azure/create-azure-dev2.shanddeploy/aws/create-aws-dev3.sh. Same shape: VPC + control plane VM- worker VM + GCS bucket + IAM service account.
Packer template:
deploy/packer/worker-ami-gcp.pkr.hcl. Same provisioning as the AWS template (install QEMU, copy binaries, install systemd unit) but builds a GCE image instead of an AMI.Optional secrets backend:
internal/secrets/gcpsecretmanager.goif you want to use GCP Secret Manager for the bootstrap config bundle.
That's it. None of the rest of the codebase changes.
Things that are NOT cloud-specific (despite looking like they could be)
Sandbox storage paths (
/data/firecracker/images,/data/sandboxes): established by the AMI / image, identical across clouds. Avoid forking these per cloud — the cost is debugging confusion later.Worker binary: same
linux/amd64build runs anywhere. We may addlinux/arm64builds for ARM-based instance families (Graviton, Ampere) but that's an instruction-set choice, not a cloud one.gRPC / HTTP APIs: standard protocols. Cloud-specific NSG/SG rules open the same ports.
Postgres schema, Redis stream layout, S3 keyspace: identical across cells regardless of cloud.
R2 as canonical resource store
Per-cell S3-compatible buckets (Azure Blob, AWS S3, GCS) are caches. Canonical golden rootfs blobs and template blobs live in Cloudflare R2, which is the only object store available identically from every cloud.
When a worker needs a golden it doesn't have, it pulls from R2 and caches locally. This eliminates "the canonical golden lives in westus2 Azure Blob" as a hidden assumption and makes new cells truly portable.
See the planning doc and the golden_versions D1 table for details.