cloud

Cloud Cost Optimization: Reducing AWS and GCP Infrastructure Spend by 40% with Karpenter and Spot Instances

Practical FinOps engineering techniques to slash cloud compute bills using dynamic just-in-time Node provisioning, intelligent Spot node failover, and right-sizing analysis.

By Shubhankar Tripathi • • 17 min read
## Introduction Cloud infrastructure waste accounts for over $30 billion in squandered enterprise budgets annually. The primary culprits: **idle EC2 instances**, **over-provisioned Kubernetes requests**, and **reluctance to leverage 70%-discounted Spot instances**. In this guide, you will deploy **Karpenter** on AWS EKS to replace sluggish Cluster Autoscaler node groups with sub-second, multi-architecture node bin-packing. --- ## Step 1 — Understanding Karpenter NodePools Unlike legacy Autoscaling Groups (ASGs), Karpenter evaluates unschedulable pod requirements directly and provisions exact-fit EC2 instances without pre-defined instance pools. Define `nodepool.yaml`: ```yaml apiVersion: karpenter.sh/v1beta1 kind: NodePool metadata: name: default spec: template: spec: requirements: - key: karpenter.sh/capacity-type operator: In values: ["spot", "on-demand"] - key: kubernetes.io/arch operator: In values: ["amd64", "arm64"] - key: karpenter.k8s.aws/instance-category operator: In values: ["c", "m", "r"] - key: karpenter.k8s.aws/instance-generation operator: Gt values: ["5"] nodeClassRef: name: default limits: cpu: 1000 memory: 2000Gi disruption: consolidationPolicy: WhenUnderutilized expireAfter: 720h ``` --- ## Summary With Karpenter's `WhenUnderutilized` consolidation policy, your cluster automatically drains and terminates low-density nodes, maintaining maximum CPU bin-packing efficiency 24/7.