Skip to content

EC2 plugin: add DescribeInstanceTypes, DescribeInstanceTypeOfferings, DescribeSpotPriceHistory #234

Closed

Description

@scttfrdmn

Summary

The EC2 plugin currently covers instance lifecycle (Run/Describe/Terminate/Stop/Start) and VPC/subnet/SG/routing. Three additional operations are needed to enable meaningful testing of truffle (scttfrdmn/spore-host), which is an EC2 instance-type discovery and Spot pricing library.

Motivating consumer

truffle/pkg/aws/client.go (814 lines, 21 functions, currently zero test coverage in CI) exports three core methods that call exactly these operations:

  • GetInstanceTypes → DescribeInstanceTypes (paginated)
  • SearchInstanceTypes → DescribeInstanceTypes + DescribeInstanceTypeOfferings
  • GetSpotPricing → DescribeSpotPriceHistory

Without them, truffle's primary library cannot be tested in CI without real AWS credentials.

Requested additions

1. DescribeInstanceTypes

Pre-seed a catalog of ~8 instance types in us-east-1 and us-west-2:

Instance Type vCPU Memory (GiB) Notes
t3.micro 2 1 General purpose
c5.xlarge 4 8 Compute optimized
c5.2xlarge 8 16 Compute optimized
m5.large 2 8 General purpose
r5.xlarge 4 32 Memory optimized
p3.2xlarge 8 61 GPU (V100)
g4dn.xlarge 4 16 GPU (T4)
inf1.xlarge 4 8 Inferentia

2. DescribeInstanceTypeOfferings

Return the seeded instance types for each pre-seeded region (us-east-1, us-west-2). Filter by location (AZ or region) should work.

3. DescribeSpotPriceHistory

Return fixed stub prices for the seeded instance types so sort/filter logic is exercisable without live market data. Example prices:

Instance Type Stub Price ($/hr)
t3.micro 0.0042
c5.xlarge 0.068
c5.2xlarge 0.136
m5.large 0.038
r5.xlarge 0.076
p3.2xlarge 0.918
g4dn.xlarge 0.188
inf1.xlarge 0.076

Filtering by InstanceTypes, AvailabilityZone, StartTime, and ProductDescriptions should be respected.

Expected test patterns

func TestGetInstanceTypes(t *testing.T) {
    env := substrate.StartTestServer(t)
    cfg := // ... aws.Config pointing at env.URL
    client := ec2.NewFromConfig(cfg)
    
    out, err := client.DescribeInstanceTypes(ctx, &ec2.DescribeInstanceTypesInput{})
    // expect len(out.InstanceTypes) >= 8
}

func TestGetSpotPricing(t *testing.T) {
    env := substrate.StartTestServer(t)
    // ...
    out, err := client.DescribeSpotPriceHistory(ctx, &ec2.DescribeSpotPriceHistoryInput{
        InstanceTypes: []types.InstanceType{types.InstanceTypeT3Micro},
    })
    // expect price == 0.0042
}

Consumer repo

scttfrdmn/spore-host — truffle substrate test tracking issue will be filed there, blocked on this issue.

Activity

  1. added a commit that references this issue on Mar 20, 2026
    d70c2b7
  2. added 3 commits that reference this issue on Sep 17, 2026
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