AWS Nitro Sandboxes: where to run AI agent code now
In November 2026 AWS released Nitro Sandboxes at no extra charge, running each EKS pod or ECS task in its own lightweight VM. Does that fix the risk of running AI-generated code and untrusted PR builds in containers that share a kernel? From primary sources: how it works, isolated vs. confidential mode, the CPU and density limits that remain, the IMDS and network paths left outside the wall, and how to decide where each kind of code should run.
Contents
Data analysis agents write Python and run it on the spot, coding agents run tests, and CI builds pull requests submitted from outside. Letting AI agents execute the code they write is no longer unusual. Much of that code runs in containers on the same node as other users’ sessions. Containers share one Linux kernel, so if the kernel or the container runtime has a hole, one session can break out to the next session or to the whole node.
In the week of November 9, 2026, AWS released a feature that changes this assumption. Nitro Sandboxes run each EKS pod, ECS task or arbitrary workload on EC2 in its own lightweight VM. You enable it by adding one line, runtimeClassName, to the pod spec, and there is no extra charge. Until now, if you needed strong isolation the only option was to use separate instances; now you can choose it on the same node.
The wall gets thicker only between a sandbox and its neighbors and the parent instance, though. As far as the AWS documentation goes, the paths that let agent code read cloud credentials or talk freely to the outside world remain unless you configure otherwise.
We have been running other people’s code on one shared kernel
First, why container isolation matters now. AWS’s launch post is explicit about the motivation. Sharing a kernel is what lets containers share resources efficiently, but a kernel weakness reachable from one container puts every container on the host at risk. Given “the current rate of Linux CVEs,” AWS says, you need a structure that separates workloads from each other and from cluster operators. As discussed in the article on vulnerabilities passing 100,000 a year, in an era when holes are found faster than patches can be applied, a design that entrusts everyone’s safety to a single kernel is a losing bet.
Container walls have in fact been breached from the runtime side too. Three runc vulnerabilities disclosed in November 2025 (CVE-2025-31133, CVE-2025-52565 and CVE-2025-52881; runc is the container runtime used by Docker and much of Kubernetes) allowed a malicious container to write to files under the host’s /proc and escape the container. According to the oss-security disclosure, the default AppArmor profile did not stop the chain. The fixes are runc 1.2.8, 1.3.3 and 1.4.0-rc.3, and exploitation requires a malicious image or crafted mount configuration. In other words, the attack bites exactly when you run containers whose contents you did not write yourself.
AI agents create that situation at scale. The code an agent writes changes with the documents and issues it reads. As shown in the article on hidden AI instructions in GitHub issues, a successful prompt injection lets an attacker “run arbitrary code through the agent.” AWS’s announcement lists this first among use cases: run each session in a separate sandbox, and code executed through prompt injection stays inside one VM and disappears when the session ends.
Other options existed before: gVisor (used by Google’s GKE Agent Sandbox), Kata Containers, provider-run sandboxes such as Lambda MicroVMs (released June 22, 2026) and E2B, and simply separating instances. The next section compares their weaknesses and where Nitro Sandboxes fit.
Not a nested VM, but a VM running “next to” the parent instance
So what is Nitro Sandboxes doing technically? The right side of the cover image summarizes the architecture described in the EC2 and EKS documentation.
A Nitro Sandbox is a lightweight VM that runs on vCPUs and memory donated by an EC2 instance (the parent instance). It is not nested inside the parent; it runs as a “first-level guest” on the Nitro Hypervisor alongside the parent. According to AWS, that is why CPU and memory perform like an EC2 instance, and why code in the sandbox cannot touch the parent’s memory. The only virtual machine monitor (VMM) currently supported is Firecracker, which creates sandboxes through the parent instance’s Nitro Enclaves driver, so the parent must be launched with Nitro Enclaves enabled.
The existing Nitro Enclaves were an extremely minimal environment with dedicated CPU cores, connected to the parent only through a local channel called vsock. Nitro Sandboxes builds on the same foundation but time-shares CPU cores with the parent and can attach virtio network and block devices, so it behaves as an ordinary VM that can host containers.
On EKS, when the kubelet receives a pod that specifies the isolated-sandbox or confidential-sandbox runtime class, a shim on the parent instance (containerd-shim-nitro-sandbox-v2) starts a Firecracker microVM, and an agent inside runs the containers with its own containerd. It requires clusters on Kubernetes 1.36 or later, and AWS recommends starting with EKS Auto Mode. On ECS it works with ECS Managed Instances by specifying isolationMode in the task definition’s trustedExecutionConfiguration. Network policies and security groups are enforced on the parent instance outside the sandbox, so a compromised workload cannot remove them.
Lining it up against the alternatives makes its position clearer.
| Approach | Kernel | Who operates it | Main constraints |
|---|---|---|---|
| Regular containers (runc) | Shared with the node | You | A kernel or runtime hole reaches every pod |
| gVisor | Handled by a user-space kernel | You (managed on GKE) | Some system calls differ in compatibility and performance |
| Kata Containers | Per pod | You | Needs nested virtualization on cloud VM nodes |
| Nitro Sandboxes | Per pod | You (AWS only) | Limited instance types; no GPU or snapshot support |
| Lambda MicroVMs, E2B, etc. | Per session | The provider | Data runs outside your own nodes; higher price per hour of use |
| Separate instances | Per instance | You | No consolidation, so costs add up |
What is new about Nitro Sandboxes is not the VM wall itself but that AWS now provides it for free, attached by adding one field to existing EKS pod or ECS task definitions. Where Kata assumed nested virtualization, AWS solved the problem in its own hypervisor. The trade-off is that it works only inside AWS. For an example of nested virtualization itself becoming an escape route to the host, see the article on the KVM flaw CVE-2026-99312.
Choose the mode by whether you are defending against “the pod next door” or “your own admins”
Nitro Sandboxes offers two modes on EKS and ECS. The difference is whether you trust the parent instance (the node) and its administrators. To decide which suits AI agent code execution, let’s look at what the EKS documentation says.
Isolated mode trusts the node and does not trust the workload inside. Its purpose is to protect the node and neighboring pods from a compromised container. exec, log retrieval and stats work as before, and the overlay file system is not encrypted, to keep pod startup fast. And by default, IMDS (the Instance Metadata Service), NTP and Pod Identity credentials are available, so workloads that rely on AWS credentials run without extra configuration.
Confidential mode does not trust the node. Its purpose is to protect workload data from cluster and node administrators and from a compromised parent instance. A Cedar policy generated for each pod pins the image digest, arguments, environment variables, mounts and so on, and exec, standard input and process listing are denied. The Nitro Secure Module inside the sandbox measures the boot image and policy and issues a signed attestation document. If an AWS KMS key policy conditions on those measurements, decryption keys go only to sandboxes running approved code. Use cases include placing a model whose weights are not public in a customer’s account.
For AI agent code execution, what you usually want to protect is “my nodes and other users from untrusted code.” That is exactly what isolated mode is for, and confidential mode’s extra effort is unnecessary. Confidential mode matters only when the parties you are defending against include your own cluster administrators or operators on AWS.
No extra charge, but a ceiling on how much you can pack in
If isolated mode is enough, should every pod be a sandbox? “No extra charge” means there is no fee for the feature, not that the cost of running VMs has vanished. Here are the constraints from the EC2 documentation, in the order they affect node design.
CPU matters most. On instances with two threads per core (most Intel and AMD instances), a physical core runs only one sandbox or the parent at a time. So the compute available to sandboxes tops out at the number of physical cores, roughly half the vCPUs. Graviton has one thread per core, so it does not lose this half. You can run up to five sandboxes per parent vCPU and 896 per instance, and without CPU overcommit, the sandboxes’ total vCPUs cannot exceed “the parent’s vCPUs minus the first core.”
Take an m7i.2xlarge with 8 vCPUs and 32 GiB. With overcommit, you can place up to 40 one-vCPU sandboxes, but actual compute is capped at four physical cores shared with the parent. Without overcommit, you can allocate only up to 6 vCPUs. For memory, each sandbox uses 2 MiB from the pool on top of its own allocation (plus 16 MiB per virtual device in confidential mode), and the concurrent-sandbox slots start at four and use 128 MiB for each step of eight you add. Running 40 sandboxes of 512 MiB each means raising the slots to 44, for about 20.7 GiB in total. CPU runs out before memory.
Other constraints may require design changes:
- Supported instance types are limited; flex instances such as C7i-flex and the smallest size in each family (such as m7i.large) cannot be used.
- GPU passthrough is not currently available; even on GPU instances, sandboxes run CPU work only.
- You cannot change vCPU or memory while running, and snapshot restore, pause and resume, and live migration are not supported. A sandbox is born with its pod and dies with it.
- AWS has not published official startup-time figures.
The lack of pause and resume matters for agents. If you stop a session mid-conversation and resume later, Lambda MicroVMs, which support snapshots, fit better. With Nitro Sandboxes you write state out to S3 or similar and recreate the sandbox.
What about cost? A comparison by Qovery’s CEO puts one hour of 2 vCPUs and 4 GiB at $0.17 for E2B and Daytona, $0.25 for Lambda MicroVMs (list prices as of November 10, 2026), and $0.05–0.07 for Nitro Sandboxes on EKS. But the last figure is the author’s estimate assuming nodes are always full, excludes the EKS control plane ($0.10 an hour) and operational effort, and the author’s company sells a competing product. Rather than trusting the numbers themselves, it is more reasonable to read them as a structure: the more you have a team that can run EKS and the larger and steadier your usage, the more Nitro Sandboxes comes out ahead.
The inside of the wall is protected; the keys you hand over and the paths out are not
So far we have seen that Nitro Sandboxes solves the shared-kernel problem at an acceptable cost. Does that make agent code execution safe? The next figure separates what the sandbox wall stops from what it does not.
Every path on the right is written in the documentation. First, credentials. EKS isolated mode allows IMDS and Pod Identity by default, so the permissions of the IAM role attached to the pod’s service account are usable by generated code inside the sandbox. When using EC2 directly, the sandbox itself has no IMDS, but if the parent instance relays traffic via NAT or similar, it can reach the parent’s IMDS and read the parent’s IAM role credentials. The EC2 documentation says IMDSv2 and Amazon Linux 2023’s hop limit of 2 do not prevent this, and asks you to deny traffic to 169.254.169.254 on the parent instance.
Second, the network. On EKS, adding sandbox.amazonaws.com/network-isolated: "true" to a pod starts the sandbox with no network device, so DNS, IMDS and Pod Identity are unavailable. But the documentation itself cautions that the vsock path remains, so this is not absolute isolation, and HTTP health checks no longer work. Agents that call external APIs cannot use this setting, so you need a separate egress allowlist. The documentation also lists as a constraint that one sandbox can exhaust shared resources on the parent instance, such as the connection-tracking table.
Third, the tokens you hand to agent sessions and shared storage. If you pass a GitHub token, SaaS API keys or database connection details into a session, generated code can use them. If multiple pods mount the same EFS, that becomes a passage between sandboxes. The VM wall guarantees “you can’t get into the room next door,” but it does not stop someone from using the key you left in the room to open the outside door. As shown in the article on the 1Password breach, keys left in CI/CD become a shortcut to production.
AWS itself admits the wall is not enough. Strands Box, an open-source project it released in October, adds to OS-level isolation a policy engine that approves an agent’s tool calls against its history of actions. The Register explained the background: containers and microVMs isolate agents well, but they do not enforce contextual rules such as an agent with tools deleting a production database. In the same article, AWS’s Marc Brooker said agent safety “is an area where the industry still has big challenges.” Red Hat has also described a setup in which agents hold only fake credentials that are swapped for real ones at the moment traffic leaves. Brooker added that even with permissions set correctly, an agent’s actions can still produce unwanted results. Kernel escapes can be stopped by a wall, but how legitimately granted permissions are used is a problem outside the wall. Nitro Sandboxes made the former cheap; it does not touch the latter.
Now that isolation is cheap, decide what to hand over before you run anything
Given all this, the question for companies is not “should we use Nitro Sandboxes?” but how to separate where code runs by where it came from and what permissions it gets.
Start by sorting the code that runs on your nodes by origin. Code your team wrote and reviewed can stay in regular containers. Code nobody has checked, such as agent-generated code, builds of pull requests from outside, and scripts uploaded by customers, goes inside a VM wall per session or job. Choose the container for that by your organization’s setup: Nitro Sandboxes in isolated mode if you have a team that runs EKS or ECS and want data to stay in your own account; Lambda MicroVMs or an external sandbox service if you want to start without running infrastructure; confidential mode if you also need protection from your own administrators.
Then close the paths outside the wall one by one. Add network-isolated to jobs that can take it, and put a destination allowlist in front of agents that talk to the outside. Use service accounts with no Pod Identity association for pods that run in sandboxes, and in isolated mode check from inside the pod whether IMDS is actually reachable. If you run directly on EC2, block 169.254.169.254 on the parent instance. Issue tool tokens per session, narrow their scope and give them short expirations. Delete the sandbox when the session ends, and if you keep state, put it somewhere like S3 that is not shared with the next session.
From here on is my own speculation. AWS says it has begun upstreaming the work to Linux and other VMMs, and Google offers Agent Sandbox with gVisor on GKE. Being able to choose “a separate kernel per pod” in managed Kubernetes will likely become a standard option before long. Once that happens, the question for comparing agent platforms will shift from “which sandbox do we use?” to “what do we give the sandbox, and where do we let it talk?”
In that sense, I think this announcement did not solve the AI agent security problem but clarified where the problem lives. The inexcusable weakness of running other people’s code in containers that share a kernel can now be eliminated at no extra charge. What remains is the design that no provider will decide for you: which keys you hand an agent, and where you let it talk. On the day you enable sandboxes, open the IAM role attached to that pod’s service account and check it. That is the right place to start using this feature.
References
- AWS Compute Blog, “Nitro Sandboxes: Hardware isolation for every EKS pod, ECS task, and EC2 workload” (November 10, 2026): https://aws.amazon.com/blogs/compute/nitro-sandboxes-hardware-isolation-for-every-eks-pod-ecs-task-and-ec2-workload/
- Amazon EC2 User Guide, “Isolate workloads with AWS Nitro Sandboxes”: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/amazon-ec2-nitro-sandboxes.html
- Amazon EKS User Guide, “Sandboxing on Amazon EKS with isolated and confidential pods”: https://docs.aws.amazon.com/eks/latest/userguide/sandboxing.html
- Cloud Native Now, “AWS Rolls Out Nitro Sandboxes to Give Containers Their Own VM Security Boundary” (November 17, 2026): https://cloudnativenow.com/features/aws-rolls-out-nitro-sandboxes-to-give-containers-their-own-vm-security-boundary/
- Qovery, “AWS Nitro Sandboxes on EKS vs Daytona vs E2B”: https://www.qovery.com/blog/aws-nitro-sandboxes-eks-vs-daytona-e2b
- AWS What’s New, “AWS introduces Lambda MicroVMs for isolated execution of user and AI-generated code” (June 2026): https://aws.amazon.com/about-aws/whats-new/2026/06/aws-lambda-microvms
- The Register, “AWS launches open-source AI agent sandbox to prevent YOLO mode disasters” (October 7, 2026): https://www.theregister.com/a/5301687
- oss-security, “runc container breakout vulnerabilities” (November 2025): https://www.openwall.com/lists/oss-security/2025/11/05/3
- CNCF Blog, “runc container breakout vulnerabilities: a technical overview” (November 28, 2025): https://www.cncf.io/blog/2025/11/28/runc-container-breakout-vulnerabilities-a-technical-overview/
- Google Cloud, “Isolate AI code execution with Agent Sandbox”: https://docs.cloud.google.com/kubernetes-engine/docs/how-to/agent-sandbox