Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Calculates the cost of an Azure Container Instances container
// Calculates the cost of an Azure Container Instances container
// Using the default Linux container with 1 vCpu and 1.5GB vRAM
[<Measure>] type gb
[<Measure>] type cores
[<Measure>] type sec
[<Measure>] type gbPerSec = gb/sec
[<Measure>] type corePerSec = cores/sec
let gbCost = 0.0000038<gb/sec>
let coreCost = 0.0000112<cores/sec>
let calculateRatePerSecond (memoryInGb:float<gb>) (numCores: float<cores>) =
float(memoryInGb * gbCost) + float(numCores * coreCost)
let calculateHourlyRate (memoryInGb:float<gb>) (numCores: float<cores>) =
let costPerSec = calculateRatePerSecond memoryInGb numCores
(costPerSec * 60.0) * 60.0
calculateHourlyRate 1.5<gb> 1.0<cores>
// 0.6p / hour
// £1.46 / day
// £43.80 / month
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.