Docs

Differences

Internet egress

Backend.egress("internet")Requirements
AWS, CloudFormation or TerraformSupported from v3.3.36A deployment compute cluster and private sandbox subnets.
AWS, direct deploySupported from v3.3.36A new VPC created by the deployment. Default and existing VPCs are refused.
KubernetesSupportedA sandboxed RuntimeClass and a CNI that passes the NetworkPolicy probe.
AzureRefused by deployment preflightGateway transport exists, but deployment does not install the gateway.
GCP, LocalRefused by deployment preflightNo 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.

BackendImageSource buildsLifecycle
AWSARM64 Lambda MicroVM bundle. Hosted releases prepare it; direct deploy reads an S3 bundle.linux/arm64Frozen or live. Source and private base images require live.
GCPImage with the Alien sandbox agent, in Artifact Registry.linux/amd64; release adds the agent.Frozen.
AzureRegistry base with an added Alien agent, or a native catalog image with a build warning.linux/amd64; release adds the agent.Frozen.
KubernetesImage with the Alien sandbox agent.Refused; use a prebuilt image.Frozen.
LocalDocker 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:

Dockerfile
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 failureFix
SANDBOX_IMAGE_USER_INVALID: non-root UID with group 0Set 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/passwdAdd the account or use an explicit numeric UID and GID.
BUILD_CONFIG_INVALID: image USER differs across architecturesUse 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

BackendSetup and image updates
AWSSource builds require live because private ECR access is granted after registration.
GCPTerraform grants template management, allowing a rollout to replace a frozen Sandbox's image.
AzureA rollout can replace a frozen Sandbox's image. Automatic setup refuses Sandbox resources.
Kubernetes, LocalFrozen 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.

OperationAWSGCPAzureKubernetesLocal
Create, run, terminateYesYesYesYesYes
Read and write filesYesYesYesYesYes
Reconnect with getYesYesYesCreating process onlyYes
listRefusedYesRefusedCreating process onlyYes
JobsYesYesYes; native: noYesNo
Pause and resumeYesNoYes; disk resume starts a fresh bootNoNo
Preview portsDeclared ports; credentials last 30 minutesNoNoNoDeclared 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

OptionAWSGCPAzureKubernetesLocal
sandboxIdIgnoredDisplay name onlyIgnoredHonoredHonored
envRefusedRefusedAccepted with validationIgnoredIgnored
tenantKeyRefusedRefusedRefusedIgnoredIgnored
timeoutMsShortens lifetimeShortens lifetimeRefusedRefused, including reuseRefused, 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

BackendmaxLifetimeSecondsPause behavior
AWS1 to 28,800 seconds, checked even without .limits()In-guest command timeout stops while paused. A waiting command call can still time out.
GCPPositive lifetime; provider validates its upper boundNo state-preserving pause.
AzureRefusedAgent commands use in-guest timeouts. Native commands can trigger sandbox deletion 10 seconds after their timeout.
Kubernetes1 to 2,147,483,647 secondsDeadline starts when the pod starts, including time in the warm pool.
LocalRefusedNo 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.

LimitAWSGCPAzureKubernetesLocal
CPU and memoryMicroVM tiers belowEnforcedSizing rule belowPod resource limitsDocker limits
DiskMicroVM tierAccepted, not appliedAt most 20 GiB per CPU coreEphemeral storage limit/sandbox size limit
maxProcessesRefusedRefusedRefusedRefusedSupported
Output per stream4 MiB4 MiB4 MiB; native: no Alien truncation flag4 MiBNo Alien truncation flag
Create readiness wait60 secondsUp to 660 seconds across three stages120 seconds for provider readiness, then up to 60 seconds for agent activationWarm-pool claimContainer startup
File size32 MiB32 MiB32 MiB; native: provider limits32 MiBNo binding size cap
Jobs per sandbox161616; native: unsupported16Unsupported
Command timeoutRequiredRequiredRequired; native: at most 24 hoursRequiredRequired; 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 memoryPeak memoryPeak CPUDisk
512 MiB2 GiB18 GiB
1 GiB4 GiB28 GiB
2 GiB8 GiB48 GiB
4 GiB16 GiB816 GiB
8 GiB32 GiB1632 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

BackendPath resolutionRefused path error
AWS, GCP, KubernetesUnder /sandbox. Leading / means /sandbox. ., .., and symlinks are refused.SANDBOX_COMMAND_FAILED
Azure agentUnder /sandbox; leading / means /sandbox. ., .., and symlinks are refused.INVALID_INPUT for binding path checks; SANDBOX_COMMAND_FAILED for agent refusals
Azure nativeLeading / is removed; .. is refused. Azure resolves the remainder.INVALID_INPUT before sending files
LocalUnder /sandbox. Leading / means /sandbox; .. is refused. Symlinks are not checked.OPERATION_NOT_SUPPORTED

Errors and retries

SituationError or resultAction
Command or job may have runSANDBOX_OUTCOME_UNKNOWNCheck its effects before repeating it.
Command timeoutSANDBOX_COMMAND_FAILED, or SANDBOX_OUTCOME_UNKNOWN if stopping cannot be confirmedDo not assume there were no effects.
AWS or GCP create readiness failureSANDBOX_UNREACHABLEA retry can create a second sandbox.
Azure image still buildingSANDBOX_UNREACHABLERetry after the image becomes ready.
Azure create response lostSANDBOX_OUTCOME_UNKNOWNCreation may have succeeded.
Azure provider readiness timeoutSANDBOX_COMMAND_FAILEDInspect the failure before creating again.
Azure agent reports PATH_NOT_FOUND or JOB_NOT_FOUNDSANDBOX_COMMAND_FAILEDCorrect the path or job ID. The binding keeps the route and does not retry.
Azure agent readiness timeoutSANDBOX_UNREACHABLECheck the image startup and agent route before retrying.
Azure effective egress differsSANDBOX_NOT_AS_DECLAREDCreation fails; investigate the policy.
GCP file transport failureSANDBOX_COMMAND_FAILEDDiagnose connectivity; this is not a path-validation result.
Local route or Kubernetes broker failureOPERATION_NOT_SUPPORTEDCheck service reachability and the current process's sandbox claim.
Unsupported operation or optionOPERATION_NOT_SUPPORTEDCheck capabilities and options.
Invalid request, including zero lifetimeINVALID_INPUTCorrect 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" }
AWSSaved privilegedSupervisor declarations only; exact hostnames through an in-guest filterDirect cloud internet path; explicit root USER refused
GCPRefusedDirect internet; private ranges are not excluded
AzureNative hostname policy; DNS lookups can still escapeDirect internet; private ranges are not excluded
KubernetesRefusedDNS through kube-dns, with private and special-use destinations excluded
LocalRefusedDocker bridge; inter-container isolation depends on the runtime honoring enable_icc

See Security for the enforcement boundary and DNS limits.

On this page