Skip to content

feat(spawn): validate instance type constraints before launch — EFA, placement groups, hibernation #110

Description

@scttfrdmn

Summary

spawn launch validates some instance type constraints at launch time but produces cryptic errors. The UX should be proactive: validate constraints upfront and suggest alternatives.

Current behavior

$ spawn launch my-cluster --instance-type t3.small --mpi
...setting up IAM role...
...creating security group...
Error: placement group validation: instance type t3.small does not support cluster placement groups

The error fires after several AWS API calls have already been made (IAM role, security group created). The user has no way to know in advance that t3.small can't be used with --mpi.

Proposed behavior

1. Pre-flight constraint check

Before making any AWS API calls, validate that the requested instance type supports the requested features:

$ spawn launch my-cluster --instance-type t3.small --mpi
Error: t3.small does not support cluster placement groups (required for --mpi).
       Suggested alternatives: c5.large, c5n.large, c5.xlarge
       Run: truffle search "c5*" --placement-group to see all options.

2. Constraints to check pre-flight

Flag Constraint EC2 API field
--mpi placement group: cluster PlacementGroupInfo.SupportedStrategies
--efa EFA supported NetworkInfo.EfaSupported
--hibernate hibernation supported HibernationSupported
--spot spot supported InstanceStorageSupported (+ spot availability)

3. Implementation

  • Call DescribeInstanceTypes for the requested instance type (one API call)
  • Check relevant fields against the requested flags
  • If constraints aren't met, fail fast with suggestions
  • Cache results to avoid repeated API calls when launching arrays

4. Suggestions

When a constraint isn't met, offer 2-3 alternatives from the same size class:

  • t3.small → suggest c5.large (cheapest with placement group support)
  • Use truffle's instance metadata for the suggestions

Related


Migrated from spore-host/spore-host#323 — spawn issues belong on this repo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:launchlaunch path: instance-type, AMI, user-data, runenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions