tobischw / ecs-instance-type-selector

Easily find cheapest AWS configurations and cluster pricing rates, in many different configurations. Written in Elm. SIUE Senior Project.
2 stars 2 forks source link

Simplify API results #87

Closed tobischw closed 4 years ago

tobischw commented 4 years ago

Currently, the API results are horrid to work with and terribly nested. We need to write (in Elm) a function that maps it to a nicer, 1-D list of instance types, with a simple entry for pricing, vCPUs, and memory.

tobischw commented 4 years ago

@wpatton97 @PaxPax Proposal:

Ideally, we'd just like a flat list of instances that we can do quick filtering operations on. What do we all think about something along these lines...:

type alias Instances = List Instance
type alias Instance = 
     { sku: String                 -- The SKU (ID) of the EC2 instance
     , instanceType: String        -- The instance type (e.g. "m5ad.12xlarge")
     , location: String            -- This relates to the region, but for now, probably a good idea to store this (e.g. "EU (Ireland)")
     , operatingSystem: String     -- Probably a good idea to have this for future purposes
     , memory: Int                 -- The memory available, in MB. Make sure we convert to MB from whatever the API gives us.
     , vCPU: Int                   -- Number of vCPUs that this instance has available
     , prices: List PricingInfo
     }

type Price         -- Filter out any non-USD data
     = Upfront Float
     | Hourly Float

type PricingType = OnDemand | Reserved

type alias PricingInfo = 
     { pricingType: PricingType
     , offerTermCode: String    -- The code we need to show for pricing
     , price: Price
     }

Thoughts? We still need to figure out fields for IOOPS and networking bandwidth.