Repository navigation
Open
Labels
Milestone
Description
What
Add first-class support for launching and running AWS Nitro Enclaves on a spawned instance. Today spawn launches/manages the parent EC2 instance beautifully, but everything enclave — enabling enclave options at launch, the allocator, building an EIF, run-enclave, capturing enclave output — is left to the user as ad-hoc instance-side scripting.
Why (real friction)
I just hand-rolled this end-to-end to validate a /dev/nsm ioctl for a Nitro attestation tool, driving a raw instance via SSM Run Command. The enclave dance has several non-obvious sharp edges spawn could encapsulate:
- Launch-time flag. Enclaves require
--enclave-options Enabled=trueatRunInstances(can't be added later), plus an enclave-capable instance type (≥4 vCPU, e.g.m5.xlarge) and adequate root volume. - Allocator config.
aws-nitro-enclaves-climust be installed and/etc/nitro_enclaves/allocator.yamledited (memory_mib, cpu_count) and thenitro-enclaves-allocatorservice started before any enclave runs. nitro-cli build-enclaveenv gotcha. Run non-interactively (SSM/CI, no$HOME),build-enclavefails with[E51] Artifacts path environment variable not setand needsNITRO_CLI_BLOBS=/usr/share/nitro_enclaves/blobs. BothNITRO_CLI_BLOBSandNITRO_CLI_ARTIFACTSmust be exported — a 30-minute foot-gun that a tool should just handle.- Capturing enclave output. In
--debug-mode,nitro-cli consoleoutput races the enclave's exit; without a vsock server you have to keep the program alive to drain the console. Aspawn enclave run --capturethat handles this would save everyone.
Proposed shape (sketch, for discussion)
# Launch a parent already configured for enclaves (allocator preset, nitro-cli installed)
spawn launch my-enclave --instance-type m5.xlarge --enclave --enclave-memory 768 --enclave-cpus 2 --ttl 1h --on-complete terminate
# Build an EIF from a local Docker image / Dockerfile and run it, streaming console
spawn enclave run my-enclave --docker-uri myimg:test --debug --capture
# (handles NITRO_CLI_BLOBS/ARTIFACTS, allocator, build-enclave, run-enclave, console drain, terminate)Even just --enclave at launch (flag + allocator/nitro-cli bootstrap) would remove most of the pain; the enclave run subcommand is the nice-to-have on top.
Notes / scope
- This pairs naturally with spawn's TTL/auto-terminate model — enclave validation runs are inherently ephemeral (mine cost < $1 and self-terminated would've been ideal).
- Prior art for the exact instance-side sequence (install, allocator, blobs env, build-enclave, debug-mode console capture, teardown) is available — happy to share the working SSM command sequence I used.
- Filed from the provabl/nitro project's perspective (a Nitro attestation producer), but this is generally useful for anyone doing enclave dev/test on ephemeral instances.
Activity