Skip to content

Support multiple instance types for spot resilience#264

Open
Harshil-Jani wants to merge 1 commit intomachulav:mainfrom
Harshil-Jani:Harshil-Jani/spot-instance-audit
Open

Support multiple instance types for spot resilience#264
Harshil-Jani wants to merge 1 commit intomachulav:mainfrom
Harshil-Jani:Harshil-Jani/spot-instance-audit

Conversation

@Harshil-Jani
Copy link

Summary

  • ec2-instance-type now accepts a JSON array of instance types (e.g. '["c5.xlarge", "c5a.xlarge", "m5.xlarge"]') in addition to a single string
  • When multiple types are provided, the action tries each type in order within each AZ configuration until one succeeds
  • Fully backward compatible — existing single-string values work unchanged

This was requested in #211 (comment by @Preen) and discussed in #85 (Fleet API suggestion). This implementation keeps the existing RunInstances approach (no new IAM permissions needed) while adding instance type diversification for better spot availability.

Changes

  • src/config.js: Parse ec2-instance-type as string or JSON array, validate contents
  • src/aws.js: Pass instanceType as parameter to createEc2InstanceWithParams, add inner retry loop over instance types within each AZ config
  • action.yml: Updated input description
  • README.md: Updated input table + new "Advanced: Multiple instance types" section
  • src/__tests__/jit.test.js: 6 new tests for parsing/validation

Test plan

  • All 31 existing + new tests pass (npm test)
  • Test with single instance type string (backward compat)
  • Test with JSON array of instance types + spot market type
  • Test with multi-AZ config + multiple instance types

Allow ec2-instance-type to accept a JSON array of instance types
(e.g. '["c5.xlarge", "c5a.xlarge", "m5.xlarge"]') in addition to a
single string. When multiple types are provided, the action tries each
type in order within each AZ configuration until one succeeds. This is
fully backward compatible — existing single-string values work unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant