Untrusted Code, Trusted Token (Part 1 of 3): What AWS Nitro Sandboxes Really Are, and Your First Sandboxed Pod on EKS

Untrusted Code, Trusted Token (Part 1 of 3): What AWS Nitro Sandboxes Really Are, and Your First Sandboxed Pod on EKS

Every EKS pod can now get its own hardware-isolated VM. Part 1 explains Nitro Sandboxes from the ground up, isolated vs confidential mode, and runs a first experiment on a real cluster.

Solution Architect | 12x AWS Certified | AWS Ambassador, Vadodara UG Leader, Community Builder
On 9 November 2026, AWS announced Nitro Sandboxes. In short: every EKS pod can now get its own hardware-isolated virtual machine, on the same EC2 node where your other pods run. You ask for it with one line in the pod spec.
I am preparing a re:Invent code talk on sandboxing AI agents on EKS (COM329), so I read everything the same week: the launch blog, the EKS User Guide, and the  EKS Nitro Sandbox blueprints  that AWS published.
One blueprint caught my attention. It runs a coding agent in an isolated sandbox. The agent reads a GitHub issue, fixes the code and opens a pull request. It is a very good starting point. But the agent, the code it runs, and the GitHub token are all in the same VM, and the token is a Kubernetes Secret mounted as a file.
That made me ask one question, and this series is my answer:
What if the repository itself is hostile? If the agent runs the repository's tests, the repository's code runs with everything the agent can reach. Can Nitro Sandboxes keep the GitHub token safe from that code, from a hijacked agent, and even from my own cluster admins?
To answer it, I built a small coding agent on EKS, split it into three trust zones, and wrote seven experiments, one for each claim I wanted to check. The series has three parts:
  • Part 1 (this one): what Nitro Sandboxes are, explained from the beginning, and your first experiment on a real cluster.
  •  Part 2 : the coding agent. You build it with three trust zones and watch it fix a real bug.
  •  Part 3 : you attack it in five ways, and I explain what Nitro Sandboxes do not protect.
This is for you if you run workloads on EKS and know pods, IAM roles and kubectl. You do not need to know Nitro, attestation or PCR registers. I explain each one when it first matters. All the code is in  AditModi/sandboxed-coding-agent , and I name the exact file every time I talk about code.
A note on evidence, because this is a security series. Where I show output, I say where it comes from. It is always one of three things:
  • a test I ran locally;
  • a result that AWS documents in the user guide or the blueprints;
  • the exact line my experiment script prints when the documented behaviour holds.

The problem: every pod on a node shares one kernel

A normal Kubernetes pod is just a group of Linux processes:
  • namespaces give it its own view of files, processes and network;
  • cgroups limit its CPU and memory;
  • seccomp filters its system calls.
All of this is enforced by one Linux kernel, the node's kernel, and every pod on the node shares it.
For most workloads, this is fine. For an AI agent, it is uncomfortable, for three reasons:
  1. The code is not yours. An agent runs code that a model wrote, or code that came with a repository. If that code finds a kernel bug, the problem is no longer inside one pod. The kernel belongs to every pod on that node.
  1. Cluster admins can see everything. Anyone with  pods/exec  permission can open a shell in the agent's pod and read its files and environment.
  1. The node can see everything. Root on the node can read the memory of every process on it. That includes the AWS credentials that EKS Pod Identity delivers to a pod ( EKS security model ).

What a Nitro Sandbox changes

A Nitro Sandbox is a lightweight virtual machine that you launch from your EC2 instance. From the instance's point of view, it looks like a child VM. Under the hood, it runs as a separate VM next to the instance, directly on the Nitro Hypervisor. That is the same hypervisor that separates EC2 instances from each other. The parent instance gives the sandbox vCPUs, memory and I/O, and Nitro enforces the boundary ( AWS Compute Blog ).
Two details matter here:
  • It is not nested virtualization. You are not running a VM inside a VM. The hypervisor enforces the CPU and memory boundary in hardware, so the code runs at near-native speed.
  • On EKS, one pod gets one sandbox. Each opted-in pod gets its own VM with its own Linux kernel. The containers of that pod share that kernel with each other, and with nobody else.
The diagram shows the same node twice. On the left, three pods share one kernel. On the right, each pod has its own kernel inside its own Nitro Sandbox.
One node, two ways: pods sharing one kernel, and each pod in its own Nitro Sandbox


Where it fits next to EC2 instances and Nitro Enclaves

When I first read the announcement, I was confused about one thing: AWS already had Nitro Enclaves, so what is new here? This comparison helped me.
EC2 instances, Nitro Enclaves and Nitro Sandboxes compared

  • An EC2 instance is the boundary we all know. It is strong, but one instance per workload is expensive. People in your company who can access the instance can still see the workload.
  • A Nitro Enclave is a very small VM carved out of an instance. It has dedicated CPU cores, no network, no disk, and only a vsock channel to its parent. It can prove what code it runs, which makes it good for keys and cryptography. But you cannot run a normal application in it.
  • A Nitro Sandbox uses the same Nitro isolation technology as Enclaves. AWS changed three things so that normal containers can run in it:
  • its vCPUs can share cores with the parent, so you can pack many sandboxes on one instance;
  • it can have normal network and disk devices;
  • it runs through a standard virtual machine monitor, such as Firecracker.
One thing to remember when you plan capacity: a sandbox does not get dedicated cores. The total sandbox vCPUs on a node can be more than the node's vCPUs ( EKS: key features ). It is a security boundary, not a performance reservation.

How a pod becomes a sandbox on EKS

When kubelet starts a pod with  runtimeClassName: isolated-sandbox , these components do the work ( EKS User Guide ):
  1. On the node, kubelet passes the pod to containerd as usual. The runtime class tells containerd to use a different shim,  containerd-shim-nitro-sandbox-v2 .
  1. The shim launches one Nitro Sandbox for the pod. This is a Firecracker microVM with vsock, disk and network devices.
  1. Inside the sandbox, an agent process ( nitro-sandbox-agent ) runs its own containerd. Before it starts anything, it checks the pod's Cedar policy. The policy decides which images may load, which containers may run, whether exec and logs are allowed, and which mounts are allowed.
  1. The container images are loaded, and the containers start on the guest kernel.
kubelet, containerd, the Nitro Sandbox shim, the microVM and the Cedar policy check

From the outside, the pod is still a normal pod:
  • the scheduler places it;
  • it gets a VPC IP address;
  • it mounts volumes through the normal drivers;
  •  kubectl logs  works.
Network policies and security groups are enforced on the node, outside the sandbox, so a compromised workload cannot switch them off.

Isolated or confidential: decide whom you don't trust

This was the most important idea for me. The two modes are not "normal" and "more secure". They protect in opposite directions ( EKS: modes ).
Isolated mode ( isolated-sandbox ) protects the node and the other pods from the pod. The node is trusted and keeps full control: exec, stdin, logs and the process list all work. Pods start faster because images load the normal way. Use it when you don't trust the code inside the pod.
Confidential mode ( confidential-sandbox ) protects the pod from the node. The node is untrusted. A Cedar policy is required, and it pins everything about the pod: image digest, arguments, environment variables, mounts and security settings. On top of that:
  • exec, stdin and the process list are denied, so the node cannot look inside;
  • the writable layer is encrypted;
  • the sandbox can prove which policy it runs, so AWS KMS can give a key only to that sandbox.
Use it when you don't trust the node, or the people who operate it.
Isolated mode protects the node from the pod; confidential mode protects the pod from the node


The three things you control

Everything you control is a normal pod field:
  1. The runtime class:  runtimeClassName: isolated-sandbox  or  runtimeClassName: confidential-sandbox . Pods without it use the normal runtime. On EKS Auto Mode, both runtime classes exist from the start, and Auto Mode brings up a node that can run sandboxes when a pod asks for one. The cluster must run Kubernetes 1.36 or later.
  1. One annotation to remove the network:  sandbox.amazonaws.com/network-isolated: "true" . This is not a firewall rule. The VM boots without a network device, so it has no route, no DNS, no instance metadata and no Pod Identity credentials.  kubectl exec ,  cp  and  logs  still work, because they use the VM's internal vsock channel. HTTP health probes stop working, so use exec probes ( EKS User Guide ).
  1. A Cedar policy: you generate it from the pod manifest with  eks-nitro-sandbox-genpolicy  and attach it as the  sandbox.amazonaws.com/policy  annotation. It is optional in isolated mode and required in confidential mode. In Part 2, it becomes the key to everything.

Try it: create the cluster

Now let's make this real. You need:
  • an AWS account;
  • a Linux x86_64 machine with Docker, the AWS CLI, kubectl, eksctl and jq (a small Amazon Linux 2023 EC2 instance works well).
Linux is needed because AWS publishes the policy generator only for Linux, and we use it in Part 2.
git clone https://github.com/AditModi/sandboxed-coding-agent.git
cd sandboxed-coding-agent
cp .env.example .env # set AWS_REGION if you want something other than us-west-2
scripts/00-cluster.sh
The script does three things:
# 1. Nitro Sandboxes need Kubernetes 1.36+, and eksctl's default is older.
eksctl create cluster --name "$CLUSTER_NAME" --region "$AWS_REGION" \
--version 1.36 --enable-auto-mode

# 2. Auto Mode accepts NetworkPolicy objects but does not enforce them until you turn this on.
kubectl patch configmap -n kube-system amazon-vpc-cni --type merge \
-p '{"data":{"enable-network-policy-controller":"true"}}'

# 3. The two runtime classes Auto Mode ships. You install nothing.
kubectl get runtimeclass isolated-sandbox confidential-sandbox
AWS's blueprint says the cluster takes about 15 minutes.

Experiment 1: what does the workload see?

Claim: a sandboxed pod runs on its own VM and kernel, and the network-isolated variant has no way out.
experiments/e1-what-the-workload-sees.sh
The script runs the same probe (  apps/agent/experiments/probe.py  ) in three pods. The pods differ only in the runtime class and one annotation:
  • an ordinary pod;
  • an  isolated-sandbox  pod;
  • an  isolated-sandbox  pod with  network-isolated: "true" .
The probe prints what the workload sees, and then seven checks that answer the question "can it get out?". Each check prints  PASS  when the code is contained and  FAIL  when it is not.
The values below come from AWS's hello-sandbox and Cedar policy blueprints, where AWS ran the same checks. Your instance types may differ.
Signal
Ordinary pod
isolated-sandbox
+ network-isolated
machine (DMI product name)
the node's instance type, e.g. m8a.xlarge
the sandbox VM, e.g. m8i.enclave
the sandbox VM
disks
the node's nvme devices
virtio vda, vdb, ...
virtio vda, vdb, ...
uptime
the node's uptime, often hours
about the pod's age
about the pod's age
interfaces
eth0 lo
eth0 lo
dummy0 lo (no address on dummy0)
route, DNS, TCP, metadata, Pod Identity
reachable: FAIL
reachable: FAIL
none: PASS
Three things to notice:
  1. The uptime trick. The sandbox's kernel booted together with the pod, so its uptime is the pod's age. This is the simplest proof that the pod is in its own VM. In AWS's blueprint, a new sandboxed pod was ready in about 5 to 6 seconds once the node was up.
  1. Kernel isolation and network isolation are separate decisions. The isolated pod without the annotation still has normal networking.
  1.  dummy0  surprised me. AWS's Cedar policy blueprint explains it: it is a placeholder with no IPv4 address, and there is no route at all.
When you are done looking, delete the probe pods. Keep the cluster for Part 2.
kubectl delete namespace lab-probe

Coming up in Part 2

Now you know what a sandbox is and how to ask for one. In  Part 2 , we build the coding agent: a brain that talks to the model, hands that run untrusted code with no network, and a broker in confidential mode that is the only holder of the GitHub token. You will also see how attestation works, step by step, and the agent will fix a real bug and open a real pull request.

Sources

Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article