Opscraft
Cloud cost control (FinOps) · Lesson 3 of 6 · 5 min read

Optimising compute

Rightsizing and modernising

  • Rightsize: compare CPU, memory and network use against instance size over a few weeks (Compute Optimizer needs the CloudWatch agent for memory data). A server averaging 8% CPU on an m5.2xlarge can often run on an m7g.large.
  • Move to current generations and Graviton: newer instance families give more performance per dollar, and Graviton (arm64) is typically around 20% cheaper for similar or better performance. Containers and interpreted languages usually move easily; build multi-architecture images.
  • Turn things off: development and test environments running nights and weekends burn about 70% of their hours idle. Schedule them down (Instance Scheduler, scaling Auto Scaling groups or node pools to zero, stopping RDS) and spin up preview environments on demand.
  • Delete the forgotten: stopped instances still pay for EBS; unattached volumes, idle load balancers, unused Elastic IPs and old AMIs all cost money every month.

Paying less for what you use

Option Discount vs on-demand Commitment Good for
Compute Savings Plans Up to about 66% $/hour for 1 or 3 years, any instance family, region, OS; also Fargate and Lambda Steady baseline that may change shape
EC2 Instance Savings Plans Up to about 72% $/hour for one instance family in one region Very stable fleets
Reserved Instances Similar A specific instance type RDS, ElastiCache, OpenSearch, Redshift (where Savings Plans don't apply)
Spot Instances Up to about 90% None, but AWS can reclaim with a 2-minute warning Stateless, fault-tolerant, flexible workloads

How to use them together:

Enlarge diagramgreen: Savings Plan baseline · orange: Spot and on-demand peaks (24 hours)
Figure 1. Cover the steady baseline with commitments, the variable part with Spot and on-demand.
Swipe sideways to see all of it, or tap to open it full screen.
  • Cover the steady baseline (the lowest usage level you're confident about for the term) with Savings Plans; leave peaks on on-demand or Spot. Over-committing wastes money just like over-provisioning.
  • Track coverage (what share of eligible usage is discounted) and utilisation (what share of the commitment you actually use). Aim for high utilisation first.
  • Spot: diversify across many instance types and AZs, use capacity-optimised allocation, handle the interruption notice (drain the node, checkpoint work), and keep a slice of on-demand for critical pods. Good fits: CI runners, batch jobs, stateless web tiers behind load balancers, dev clusters.
Enlarge diagramDiversifymany types and AZsCapacity-optimisedallocation strategyInterruption notice2 minutes: drain, checkpointPDBs and spreadnever all replicas on SpotOn-demand floorfor critical servicesMeasureinterruptions, savings123456
Figure 2. Running Spot safely: diversify, handle the 2-minute warning, keep critical pods on on-demand.
Swipe sideways to see all of it, or tap to open it full screen.

Kubernetes-specific savings

  • Requests drive cost: nodes are bought to fit requested resources. Set requests from observed usage (VPA in recommendation mode, Goldilocks, or Kubecost's suggestions), and review the largest gaps between requested and used.
  • Bin packing: Karpenter chooses instance types to fit pending pods and consolidates by moving pods off under-used nodes and removing them. Set consolidationPolicy: WhenEmptyOrUnderutilized with disruption budgets.
  • Mix capacity: a Karpenter NodePool allowing Spot and on-demand, multiple instance families and both architectures gives the scheduler room to pick the cheapest option.
  • Scale to demand: HPA or KEDA scale pods down overnight; Karpenter or the Cluster Autoscaler removes the empty nodes.
  • Avoid tiny clusters per team: each EKS cluster has a control-plane fee and its own overhead (system pods, spare capacity). Shared multi-tenant clusters with namespaces are usually cheaper, as long as isolation needs allow it.
  • Clusters on old Kubernetes versions past standard support pay a much higher per-hour extended support fee; keep upgrades current.
Enlarge diagramBefore: 4 nodesAfter consolidation: 2 nodesnode 1: 70% requestednode 2: 25%node 3: 20%node 4: 15%node 1: 70%node 5 (cheaper type): 60%nodes 2–4 removedPDBs respected throughout
Figure 3. Karpenter consolidation: move pods off under-used nodes and remove them.
Swipe sideways to see all of it, or tap to open it full screen.