Skip to main content

Run a Workload on AWS Nitro

Run a Docker application inside an AWS Nitro Enclave — one of the strongest isolation guarantees available in the public cloud. The host OS cannot read your enclave’s memory, even with root access.
Important: On AWS Nitro, your workload runs inside an AWS Enclave OS image — not a dstack CVM. The Guest Agent is not available. dstack-util is packaged into the Enclave for attestation and key retrieval. You control how keys are used (for example disk/data decryption in your app).

Prerequisites

  • AWS account permissions for EC2 + Nitro Enclaves
  • AWS CLI configured (aws configure)
  • Docker installed
  • Git + gh CLI (if using GitHub template/release flow)
  • The dstack-nitro-enclave-app-template repository

Overview

Deployment flow:
  1. Create app from template
  2. Replace KMS root CA certificate (required before build)
  3. Build EIF and get measurements
  4. Register OS_IMAGE_HASH on-chain
  5. Deploy/run on Nitro host and retrieve keys

Key Delivery via KMS

On Nitro, dstack-util inside Enclave reaches KMS through host-side VSOCK proxy. KMS verifies Nitro attestation and policy before returning keys. KMS Options Self-hosted KMS can run on:

Step 1: Create Your App from Template


Step 2: Replace KMS Root CA Certificate

⚠️ Required. Template app/root_ca.pem is placeholder only.
root_ca.pem is baked into image and affects measured hash.
Use a domain name in KMS URL when possible. Avoid raw IP in production.
If KMS CA rotates, rebuild EIF and re-register new image hash.

Step 3: Configure and Build EIF

3.1 Template Variables

app/entrypoint.sh uses placeholders:
Do not hardcode manually; pass via build inputs.

3.2 Local Build

or source build variant:

3.3 GitHub Actions Build

3.4 Output

./output/:
  • enclave.eif
  • measurements.json
  • measurements.sigstore.json (CI)
Output includes:
  • PCR0, PCR1, PCR2
  • OS_IMAGE_HASH = sha256(PCR0 || PCR1 || PCR2)

Step 4: Register OS_IMAGE_HASH On-chain

Before key retrieval, register measured image hash.

Development

Production

Use governance/multisig/timelock flow. See Register Workload Measurements.

App policy check (important)

For successful GetAppKey, app policy must also allow your runtime attestation:
  • compose hash/image hash allowed (app:add-hash)
  • device policy satisfied (either allowAnyDevice=true or device explicitly added)
Useful commands:

Step 5: Deploy on EC2

5.1 Launch Nitro-capable instance

5.2 Install Nitro tooling

5.3 Allocator resources

/etc/nitro_enclaves/allocator.yaml:

5.4 Run EIF

5.5 Verify


Entrypoint Notes

The template uses dstack-util get-keys and a VSOCK proxy for key retrieval. Keys are returned to /var/run/dstack/keys.json inside the enclave, or captured on the host via VSOCK in helper scripts.
Important: The KMS URL, APP_ID, and root_ca.pem are all baked into the enclave image and affect the measured hash. You must use the exact same inputs between --show-mrs preview and the real run — any difference produces a different OS_IMAGE_HASH.

Troubleshooting


Differences from GCP

Nitro and GCP take fundamentally different approaches. On GCP, the Guest Agent handles attestation, key management, and automatic disk encryption. On Nitro, dstack-util only retrieves the key — your application decides what to encrypt. For a full comparison, see the overview and KMS and Key Delivery.

Next Steps