Skip to content

spawn launch: --nested-virtualization flag (+ validate instance-type support) #91

Closed

Description

@scttfrdmn

Summary

Add spawn launch --nested-virtualization to run a hypervisor (KVM/Hyper-V) inside a virtual EC2 instance — no bare metal required. AWS added nested virtualization on virtual instances (Feb 2026, all commercial regions, no extra cost) for C8i/M8i/R8i. This unblocks building VMs/AMIs (e.g. the Windows custom AMI, #83) with hardware-accelerated qemu/KVM on a cheap virtual instance instead of a ~$4/hr .metal.

Behavior

  • --nested-virtualization sets RunInstancesInput.CpuOptions.NestedVirtualization = enabled
    (SDK: types.CpuOptionsRequest{NestedVirtualization: NestedVirtualizationSpecificationEnabled}).
  • Validate at launch (must-have): if the flag is set but the chosen instance
    type doesn't support it, reject with a clear error rather than letting
    RunInstances fail cryptically. Probe via DescribeInstanceTypes →
    ProcessorInfo.SupportedFeatures contains "nested-virtualization". Mirror the
    existing ValidateInstanceTypeForEFAInRegion (pkg/aws/placement.go:106) which
    does the same DescribeInstanceTypes→field-check→error pattern for EFA.
    • Confirmed: c8i/m8i/r8i.* → SupportedFeatures: ["nested-virtualization"];
      c5.4xlarge → null.
  • Don't hardcode the family list — read the support field, so new families work
    automatically.

Plumbing

  • LaunchConfig.NestedVirtualization bool → CpuOptions on RunInstances
    (pkg/aws/client.go).
  • --nested-virtualization flag + wire into buildLaunchConfig (cmd/launch.go).
  • Windows-on-Windows caveat (from AWS docs): nested virt disables Credential
    Guard/VSM and blocks hibernate; CPU limit 192 on Windows. Worth a note, not a
    blocker for the Linux-KVM build use case.

Related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions