Repository navigation
Release v1.0.2
Release Date: December 12, 2025
🆕 What's New
This release introduces instance type specification, improved parameter validation, comprehensive test coverage, and several bug fixes.
✨ New Features
Instance Type Specification (--instanceType)
You can now specify exact instance types instead of filtering by family, CPU, or memory:
- Comma-separated list: Specify multiple instance types (e.g.,
ecs.n1.small,ecs.n2.large) - Takes precedence: When
--instanceTypeis specified, it overrides the--familyparameter - Skips other filters: All other filters (CPU, memory, architecture) are automatically skipped
- Auto-skip invalid types: Non-existent or invalid instance types are automatically skipped
Parameter Validation
- Required parameter checking: Validates that
accessKeyIdandaccessKeySecretare provided - Helpful error messages: Displays help information when required parameters are missing
- JSON error format: Errors are output in JSON format when using
--jsonflag - No more panics: Prevents crashes when parameters are missing
🐛 Bug Fixes
- Fixed
GetPossibilityfunction: Now properly handles empty price arrays (returns 0.0 instead of causing errors) - Code formatting: Fixed indentation and formatting issues
🧪 Testing
Added comprehensive test coverage:
meta_test.go: Tests for architecture normalization, instance filtering, and price analysissort_test.go: Tests for price sorting, latest price finding, and possibility calculation- Edge case handling: Tests for empty arrays and boundary conditions
📋 Usage Examples
Specify Exact Instance Types
# Analyze specific instance types
./spot-instance-advisor \
--accessKeyId YOUR_KEY \
--accessKeySecret YOUR_SECRET \
--instanceType ecs.n1.small,ecs.n2.large,ecs.c6.large \
--jsonNote: When using --instanceType, all other filters (CPU, memory, architecture) are ignored.
Parameter Validation
# Missing required parameters now shows helpful error
./spot-instance-advisor --json
# Output: {"error": "Missing required parameters", "message": "accessKeyId and accessKeySecret are required"}Combined with Other Features
# Instance type specification with other options
./spot-instance-advisor \
--accessKeyId YOUR_KEY \
--accessKeySecret YOUR_SECRET \
--instanceType ecs.n1.small,ecs.n2.large \
--cutoff 3 \
--limit 10 \
--json📝 JSON Output Format
The JSON output format remains the same, but now works seamlessly with instance type specification:
[
{
"instanceTypeId": "ecs.n1.small",
"zoneId": "cn-hangzhou-a",
"pricePerCore": 0.1234,
"discount": 2.5,
"possibility": 0.8,
"cpuCoreCount": 1,
"memorySize": 2.0,
"instanceFamily": "ecs.n1",
"arch": "x86_64"
}
]📚 Documentation Updates
- Updated
README.mdwith--instanceTypeusage examples and behavior documentation - Updated
USAGE.mdwith detailed--instanceTypeparameter documentation - Documented that
--instanceTypeskips all other filters when specified - Added examples for instance type specification
🔄 Dependencies
- Updated
golang.org/x/sysfrom v0.37.0 to v0.39.0
🎯 Use Cases
The new --instanceType parameter is particularly useful for:
- Specific instance analysis: When you know exactly which instance types you want to analyze
- Migration planning: Comparing prices for specific instances you're currently using
- Cost comparison: Comparing prices between specific instance types
- Automation: Scripts that need to analyze predefined instance types
🔄 Migration Notes
This is a backward-compatible release. Existing scripts and workflows will continue to work without changes. The --instanceType parameter is optional and can be used alongside or instead of existing filters.
Full Changelog: v1.0.1...v1.0.2