Connect to an Existing Cube Cluster
To get started quickly, check out the example directory:
- Example: examples/e2b-dev-sidecar
- Chinese README: README_zh.md
- English README: README.md
Why we need dev-sidecar
E2B expects sandbox URLs to resolve to the target cluster's public IP through wildcard DNS. In a production deployment, that usually means adding a private DNS A record like:
*.cube.app => <your cube master node ip>That is inconvenient during local development. Setting up wildcard DNS on a developer machine is usually the annoying part, so dev-sidecar exists to let you connect your local machine to a Cube cluster and create sandboxes without changing the E2B SDK itself.
This page only does one thing: help you quickly decide how to fill the dev-sidecar environment variables.
Start With the Happy Path
Case 1: You started Cube locally with dev-env
This is the most natural and recommended development path for dev-sidecar.
If you followed Development Environment (QEMU VM), the defaults in examples/e2b-dev-sidecar/env.example were already chosen for this exact case.
Do this:
cd examples/e2b-dev-sidecar
pip install -r requirements.txt
cp env.example .envThen usually you only need to fill in the template ID:
E2B_API_URL="http://127.0.0.1:13000"
CUBE_REMOTE_PROXY_BASE="https://127.0.0.1:11443"
E2B_API_KEY="dummy"
CUBE_TEMPLATE_ID="<your-template-id>"Run:
python demo.pyThe key point is:
127.0.0.1:13000is not arbitrary. It is the CubeAPI endpoint exposed bydev-env.127.0.0.1:11443is not arbitrary. It is the CubeProxy endpoint exposed bydev-env.
So if you already booted local dev-env, you usually do not need to change the addresses. You mostly just fill in the template ID.
Case 2: You want to connect to a Cube cluster on another machine
You still use the same dev-sidecar example. You only replace the default addresses with the real endpoints of that remote cluster:
E2B_API_URL="http://<node-ip>:3000"
CUBE_REMOTE_PROXY_BASE="https://<node-ip>:443"
E2B_API_KEY="dummy"
CUBE_TEMPLATE_ID="<your-template-id>"Then run the same command:
python demo.pyJust Remember These
E2B_API_URLControl-plane endpoint. Indev-env, the default ishttp://127.0.0.1:13000.CUBE_REMOTE_PROXY_BASEData-plane endpoint. Indev-env, the default ishttps://127.0.0.1:11443.E2B_API_KEYMust be non-empty for the SDK. If auth is enabled, use the real key.CUBE_TEMPLATE_IDThe template ID used when creating the sandbox.
You usually do not need to think about the other variables first. For most development flows, getting these four values right is enough.
Common Mistakes
- You are using local
dev-env, but configured the in-VM addresses instead of the host-exposed13000/11443ports - You pointed
CUBE_REMOTE_PROXY_BASEat the sidecar's own listening address instead of CubeProxy - You forgot to set
CUBE_TEMPLATE_ID - Auth is enabled on the cluster, but
E2B_API_KEYis stilldummy
Further Reading
If you want the easiest explanation, go straight to the example README:
If you are ready to wire the sidecar into your own code, then look at:
demo.pydev_sidecar.py