Differences
Internet egress
| Backend | .egress("internet") | Requirements |
|---|---|---|
| AWS, CloudFormation or Terraform | Supported from v3.3.36 | A deployment compute cluster and private sandbox subnets. |
| AWS, direct deploy | Supported from v3.3.36 | A new VPC created by the deployment. Default and existing VPCs are refused. |
| Kubernetes | Supported | A sandboxed RuntimeClass and a CNI that passes the NetworkPolicy probe. |
| Azure | Refused by deployment preflight | Gateway transport exists, but deployment does not install the gateway. |
| GCP, Local | Refused by deployment preflight | No deployment gateway support. |
Unsupported deployments report SANDBOX_EGRESS_GATEWAY_UNAVAILABLE. They do not fall back to direct internet access.
For an existing AWS VPC, use CloudFormation or Terraform. Supply SandboxSubnetIds, SandboxGatewaySubnetIds, and SandboxGatewaySubnetCidrs.
Kubernetes routes outbound traffic only to gateway pods on port 3128. It needs no sandbox DNS exception. The cluster's network determines its outbound IP; Alien does not allocate a fixed NAT IP there.
Images
Azure agent images and the image-user contract are planned for the release after v3.3.40. The tables below describe that release. See saved image behavior and Upgrade order for current releases.
| Backend | Image | Source builds | Lifecycle |
|---|---|---|---|
| AWS | ARM64 Lambda MicroVM bundle. Hosted releases prepare it; direct deploy reads an S3 bundle. | linux/arm64 | Frozen or live. Source and private base images require live. |
| GCP | Image with the Alien sandbox agent, in Artifact Registry. | linux/amd64; release adds the agent. | Frozen. |
| Azure | Registry base with an added Alien agent, or a native catalog image with a build warning. | linux/amd64; release adds the agent. | Frozen. |
| Kubernetes | Image with the Alien sandbox agent. | Refused; use a prebuilt image. | Frozen. |
| Local | Docker image on your machine. | Refused; use a prebuilt image. | Frozen. |
To build from a Dockerfile, replace .code() with:
.code({ type: "source", src: "./sandbox", toolchain: { type: "docker" } })Run alien build, then alien release. A shared Dockerfile needs a base published for both architectures. You can also select a base per architecture:
FROM public.ecr.aws/lambda/microvms:al2023-minimal AS base-arm64
FROM python:3.14-slim AS base-amd64
FROM base-${TARGETARCH}Docker sets TARGETARCH for each build. Add your application and its dependencies after the final FROM.
Native Azure images and Local images need sh, setsid, od, tr, sleep, and kill for command timeouts. Give changed Azure images a new tag or digest. Azure builds one disk image per reference.
New builds inspect the original image USER, except Azure catalog builds. Catalog builds retain native exec and may run as root.
Local and Kubernetes accept images without USER and keep UID 65534. They refuse an explicit root USER. AWS uses root for absent USER with a connector; modes without one keep UID 60000 and released startup. Explicit root requires a connector. See Users and privileges.
Local builds reuse a cached image only when its OS and architecture match the requested target. Missing images and mismatched tags pull the requested platform. A mismatched immutable image ID fails with IMAGE_BUILD_REJECTED; use a matching image or a registry tag. See image selection.
The GCP sandbox service agent needs Artifact Registry Reader on the image repository.
Image user errors
Image inspection rejects user identities that cannot run commands safely.
| Build failure | Fix |
|---|---|
SANDBOX_IMAGE_USER_INVALID: non-root UID with group 0 | Set a non-root group, for example USER 65534:65534. USER 1000 without a passwd entry defaults to group 0. USER app:root also fails. |
SANDBOX_IMAGE_USER_INVALID: user name missing from /etc/passwd | Add the account or use an explicit numeric UID and GID. |
BUILD_CONFIG_INVALID: image USER differs across architectures | Use the same UID in each architecture's image. Where absent USER selects legacy startup, do not mix it with explicit root. |
See the identity resolver and architecture check.
Setup and updates
| Backend | Setup and image updates |
|---|---|
| AWS | Source builds require live because private ECR access is granted after registration. |
| GCP | Terraform grants template management, allowing a rollout to replace a frozen Sandbox's image. |
| Azure | A rollout can replace a frozen Sandbox's image. Automatic setup refuses Sandbox resources. |
| Kubernetes, Local | Frozen resource configuration is owned by setup. |
A Worker, Container, or Daemon can link a live Sandbox. Other resources, including Build, need it frozen. Internet sandboxes also refuse Build consumers because gateway administration is private to workloads.
See Frozen & Live Resources for setup ownership and management permissions.
Operations
Call capabilities() before using optional operations on new sessions. After reconnecting, call capabilities(sandboxId) for that session's operations.
Azure entries below describe agent images unless marked native. Catalog images and saved native sessions use native transport.
| Operation | AWS | GCP | Azure | Kubernetes | Local |
|---|---|---|---|---|---|
| Create, run, terminate | Yes | Yes | Yes | Yes | Yes |
| Read and write files | Yes | Yes | Yes | Yes | Yes |
Reconnect with get | Yes | Yes | Yes | Creating process only | Yes |
list | Refused | Yes | Refused | Creating process only | Yes |
| Jobs | Yes | Yes | Yes; native: no | Yes | No |
| Pause and resume | Yes | No | Yes; disk resume starts a fresh boot | No | No |
| Preview ports | Declared ports; credentials last 30 minutes | No | No | No | Declared ports on 127.0.0.1; no expiry |
AWS reports preview only when ports are declared. Kubernetes does not report sandboxLifetime at runtime because callers cannot choose a deadline when claiming a warm pod.
GCP's resume can return a fresh container. Do not use it to preserve state. No backend reports a restorable snapshot capability.
Create options
| Option | AWS | GCP | Azure | Kubernetes | Local |
|---|---|---|---|---|---|
sandboxId | Ignored | Display name only | Ignored | Honored | Honored |
env | Refused | Refused | Accepted with validation | Ignored | Ignored |
tenantKey | Refused | Refused | Refused | Ignored | Ignored |
timeoutMs | Shortens lifetime | Shortens lifetime | Refused | Refused, including reuse | Refused, including reuse |
Use command-level env for portable code. Azure rejects create-time PATH, IFS, SHELLOPTS, BASHOPTS, LD_*, and invalid shell variable names. Agent images also reserve ALIEN_SANDBOX_*.
Lifetime
| Backend | maxLifetimeSeconds | Pause behavior |
|---|---|---|
| AWS | 1 to 28,800 seconds, checked even without .limits() | In-guest command timeout stops while paused. A waiting command call can still time out. |
| GCP | Positive lifetime; provider validates its upper bound | No state-preserving pause. |
| Azure | Refused | Agent commands use in-guest timeouts. Native commands can trigger sandbox deletion 10 seconds after their timeout. |
| Kubernetes | 1 to 2,147,483,647 seconds | Deadline starts when the pod starts, including time in the warm pool. |
| Local | Refused | No pause. |
A create-time lifetime cannot extend the declaration. Without a declared lifetime, AWS still caps sessions at eight hours. GCP applies its service default. Always terminate sandboxes after saving their results.
AWS resume waits until commands can run. It refuses a terminated sandbox. AWS, GCP, and Azure terminate wait for deletion. AWS reports SANDBOX_UNREACHABLE if it cannot confirm termination within 30 seconds.
Kubernetes terminate only deletes sandboxes claimed by the current process. For another process's sandbox, it returns success without deleting anything.
Limits
AWS resource IDs may contain at most 17 characters, or 16 with "none" egress.
| Limit | AWS | GCP | Azure | Kubernetes | Local |
|---|---|---|---|---|---|
| CPU and memory | MicroVM tiers below | Enforced | Sizing rule below | Pod resource limits | Docker limits |
| Disk | MicroVM tier | Accepted, not applied | At most 20 GiB per CPU core | Ephemeral storage limit | /sandbox size limit |
maxProcesses | Refused | Refused | Refused | Refused | Supported |
| Output per stream | 4 MiB | 4 MiB | 4 MiB; native: no Alien truncation flag | 4 MiB | No Alien truncation flag |
| Create readiness wait | 60 seconds | Up to 660 seconds across three stages | 120 seconds for provider readiness, then up to 60 seconds for agent activation | Warm-pool claim | Container startup |
| File size | 32 MiB | 32 MiB | 32 MiB; native: provider limits | 32 MiB | No binding size cap |
| Jobs per sandbox | 16 | 16 | 16; native: unsupported | 16 | Unsupported |
| Command timeout | Required | Required | Required; native: at most 24 hours | Required | Required; at most 24 hours |
Output beyond the cap is dropped. The exit frame reports truncated: true. Finished jobs count until a poll reads their result. GCP runs commands longer than 30 seconds through the jobs API.
Kubernetes keeps two idle pods per Sandbox resource. A create fails while the pool is empty. Idle pods reserve the declared CPU and memory.
AWS sizes
Alien picks the largest tier whose peak memory and disk fit. Declared CPU must cover that tier's peak CPU.
| Baseline memory | Peak memory | Peak CPU | Disk |
|---|---|---|---|
| 512 MiB | 2 GiB | 1 | 8 GiB |
| 1 GiB | 4 GiB | 2 | 8 GiB |
| 2 GiB | 8 GiB | 4 | 8 GiB |
| 4 GiB | 16 GiB | 8 | 16 GiB |
| 8 GiB | 32 GiB | 16 | 32 GiB |
The smallest accepted declaration is cpu: "1", memory: "2Gi", disk: "8Gi". Omitting .limits() selects the 2 GiB baseline tier.
Azure sizes
CPU is a multiple of 250m, from 250m to 16 cores. Memory is at most 2 GiB per declared core. Disk is at most 20 GiB per declared core.
Files
| Backend | Path resolution | Refused path error |
|---|---|---|
| AWS, GCP, Kubernetes | Under /sandbox. Leading / means /sandbox. ., .., and symlinks are refused. | SANDBOX_COMMAND_FAILED |
| Azure agent | Under /sandbox; leading / means /sandbox. ., .., and symlinks are refused. | INVALID_INPUT for binding path checks; SANDBOX_COMMAND_FAILED for agent refusals |
| Azure native | Leading / is removed; .. is refused. Azure resolves the remainder. | INVALID_INPUT before sending files |
| Local | Under /sandbox. Leading / means /sandbox; .. is refused. Symlinks are not checked. | OPERATION_NOT_SUPPORTED |
Errors and retries
| Situation | Error or result | Action |
|---|---|---|
| Command or job may have run | SANDBOX_OUTCOME_UNKNOWN | Check its effects before repeating it. |
| Command timeout | SANDBOX_COMMAND_FAILED, or SANDBOX_OUTCOME_UNKNOWN if stopping cannot be confirmed | Do not assume there were no effects. |
| AWS or GCP create readiness failure | SANDBOX_UNREACHABLE | A retry can create a second sandbox. |
| Azure image still building | SANDBOX_UNREACHABLE | Retry after the image becomes ready. |
| Azure create response lost | SANDBOX_OUTCOME_UNKNOWN | Creation may have succeeded. |
| Azure provider readiness timeout | SANDBOX_COMMAND_FAILED | Inspect the failure before creating again. |
Azure agent reports PATH_NOT_FOUND or JOB_NOT_FOUND | SANDBOX_COMMAND_FAILED | Correct the path or job ID. The binding keeps the route and does not retry. |
| Azure agent readiness timeout | SANDBOX_UNREACHABLE | Check the image startup and agent route before retrying. |
| Azure effective egress differs | SANDBOX_NOT_AS_DECLARED | Creation fails; investigate the policy. |
| GCP file transport failure | SANDBOX_COMMAND_FAILED | Diagnose connectivity; this is not a path-validation result. |
| Local route or Kubernetes broker failure | OPERATION_NOT_SUPPORTED | Check service reachability and the current process's sandbox claim. |
| Unsupported operation or option | OPERATION_NOT_SUPPORTED | Check capabilities and options. |
| Invalid request, including zero lifetime | INVALID_INPUT | Correct the request. |
SANDBOX_UNREACHABLE is retryable, but it does not make create idempotent. Backends attempt cleanup when readiness fails. A failed create can still leave a sandbox without returning its ID. AWS cannot list these sandboxes. GCP lists the resource's sandboxes without identifying which caller created them.
Plan-time refusal codes appear inside VALIDATION_FAILED messages. These include SANDBOX_CAPABILITY_UNSUPPORTED, SANDBOX_LIMIT_INVALID, and SANDBOX_EGRESS_GATEWAY_UNAVAILABLE.
Domain allowlists
The deprecated object forms retain their existing behavior.
| Backend | { mode: "allowDomains" } | { mode: "allow" } |
|---|---|---|
| AWS | Saved privilegedSupervisor declarations only; exact hostnames through an in-guest filter | Direct cloud internet path; explicit root USER refused |
| GCP | Refused | Direct internet; private ranges are not excluded |
| Azure | Native hostname policy; DNS lookups can still escape | Direct internet; private ranges are not excluded |
| Kubernetes | Refused | DNS through kube-dns, with private and special-use destinations excluded |
| Local | Refused | Docker bridge; inter-container isolation depends on the runtime honoring enable_icc |
See Security for the enforcement boundary and DNS limits.