View a markdown version of this page

CPU and memory right-sizing - AWS Prescriptive Guidance

CPU and memory right-sizing

Over-provisioned requests are the #1 hidden cost in Kubernetes. Pods requesting more than they use prevent bin-packing and force unnecessary nodes.

Identify Over-Provisioned Workloads

Compare resource requests against actual usage to find pods consuming significantly less than they reserve. Pods using less than 30% of their CPU request are candidates for right-sizing.

For kubectl-based commands to compare requests vs usage and identify waste, see the identify-over-provisioned.sh

CloudWatch: Container Insights for Right-Sizing

For a more accurate 7-day view (vs point-in-time kubectl top), use CloudWatch Container Insights metrics to measure average and peak CPU/memory utilization per namespace.

For sample commands, see the cloudwatch-right-sizing-metrics.sh

Actions

Implement Vertical Pod Autoscaler (VPA) for Recommendations, Refer to this GitHub repository for sample commands. For sample commands, to right-size pod resource requests, see this GitHub repository

Horizontal Pod Autoscaler (HPA) for Efficient Scaling, For sample commands to configured HPA for cost-efficient scaling, see this GitHub repository

Deploy VPA in "Off" mode first to collect recommendations for 7 days, then right-size requests to p95 usage + 20% buffer. Combine with HPA to scale horizontally at 70% utilization, this keeps pods lean while handling traffic spikes.

Key takeaway: Over-provisioned requests are invisible waste, they don't show up as errors or alerts, but they force extra nodes to exist. Right-sizing is often the single biggest cost win within an active cluster.