Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

import polars as pl
df = pl.read_csv("aws_ec2_vm_instances.csv")
df = df.with_columns(
    hourly_cost=pl.col("hourly_cost").str.lstrip("$").cast(float),
    memory=pl.col("memory").str.rstrip(" GiB").cast(float),
    performance_per_vcpu=pl.when(pl.col("performance_per_vcpu").is_null())
    .then(1)
    .otherwise(pl.col("performance_per_vcpu")),
).with_columns(
    real_vcpu=pl.col("vcpu") * pl.col("performance_per_vcpu"),
)
df
Loading...

VM Instances With Highest vCPU / memory Ratio

(df["real_vcpu"] / df["memory"]).max()
2.0
df.filter(df["real_vcpu"] / df["memory"] >= 2)
Loading...

Cheapest VM Instance per vCPU Hour

t2.nano is the cheapest with an hourly cost of $0.0058 and a monthly cost of $4.176 per vCPU.

(df["hourly_cost"] / df["real_vcpu"]).min()
0.0058
df.filter(df["hourly_cost"] / df["real_vcpu"] <= 0.0058)
Loading...

Monthly cost (USD).

0.0058 * 24 * 30
4.176