Cloud Tech by Victor
DevOpsIntermediate

Cloud Cost Optimization

Why idle and over-provisioned resources, not raw usage, are where most cloud spend actually leaks, and the concrete levers (rightsizing, commitment discounts, autoscaling) that address it.

Updated 2026-07-223 min read

Overview

Most cloud cost problems aren't about usage being inherently expensive; they're about provisioned capacity sitting idle or oversized relative to what's actually needed, compounding silently because nothing forces a team to revisit a sizing decision made months ago. Cost optimization is the discipline of closing that gap: rightsizing resources to observed load, matching pricing models (on-demand, committed-use, spot) to how predictable and interruption-tolerant a workload actually is, and eliminating genuinely idle spend (unattached storage volumes, forgotten test environments) that provides zero value at any size. None of this is a one-time project, usage patterns and workloads change, so the waste that gets cleaned up today starts accumulating again immediately.

Quick Reference

LeverAddressesTypical savings
RightsizingOver-provisioned steady-state resourcesOften the single biggest win
Committed-use discountsPredictable, continuous workloads30–60% vs. on-demand
Spot/preemptible instancesInterruption-tolerant, flexible workloadsUp to 70–90% vs. on-demand
AutoscalingLoad-variable workloadsAvoids paying for unused peak capacity
Idle-resource cleanupUnattached volumes, forgotten environments100% of that specific waste

Syntax

hcl
# Autoscaling tied to actual observed load, not a static guess
resource "aws_autoscaling_policy" "scale_up" {
  autoscaling_group_name = aws_autoscaling_group.app.name
  policy_type             = "TargetTrackingScaling"
  target_tracking_configuration {
    predefined_metric_specification {
      predefined_metric_type = "ASGAverageCPUUtilization"
    }
    target_value = 60.0
  }
}

Examples

bash
# Find genuinely idle spend - an unattached volume costs the same
# whether it's attached to a running instance or sitting orphaned.
aws ec2 describe-volumes --filters Name=status,Values=available \
  --query 'Volumes[*].[VolumeId,Size,CreateTime]'

Tag everything, from day one

Cost attribution (which team, which project, which environment) is what makes rightsizing and cleanup decisions actionable at all. Retrofitting tags onto years of untagged resources is far more expensive than enforcing them at creation time.

Visual Diagram

Common Mistakes

  • Provisioning for peak load and never scaling back down, leaving steady-state capacity idle the vast majority of the time.
  • Using on-demand pricing for a workload that's been running continuously and predictably for months, the exact case committed-use discounts are built for.
  • Leaving orphaned resources (unattached storage volumes, unused load balancers, forgotten test environments) running indefinitely because nothing alerts on pure waste the way it alerts on an outage.
  • Setting autoscaling minimums far above actual baseline load "to be safe," which quietly defeats much of autoscaling's cost benefit.

Performance

  • Aggressive cost-cutting can trade away real performance margin, rightsizing too tightly against average load leaves no headroom for legitimate spikes, causing degradation exactly when it matters most.
  • Spot/preemptible instances introduce interruption as a real operational concern; workloads using them need to handle reclamation gracefully (checkpointing, retry logic) or the "savings" show up as reliability cost instead.
  • Committed-use discounts lock in capacity assumptions for their term, a workload that shrinks significantly during that period turns a discount into paid-for-but-unused capacity, so commitments should track only genuinely stable baseline usage.

Best Practices

  • Tag every resource with owner/team/environment from creation, since cost attribution is what makes every other optimization actionable.
  • Rightsize on a recurring cadence using actual utilization data, not a one-time pass, usage patterns drift.
  • Match pricing model to workload predictability: committed-use for stable steady-state, spot for interruption-tolerant and flexible, on-demand for genuinely unpredictable or short-lived needs.
  • Set up automated detection for idle resources (unattached volumes, empty load balancers) so waste gets caught continuously, not only during periodic manual audits.

Interview questions

Why is "rightsizing" usually the highest-leverage cost optimization, and why do teams under-invest in it?

Rightsizing means matching provisioned capacity (instance size, allocated memory) to actual observed usage, and it typically has the biggest impact because most cloud resources are provisioned for a peak or a guess, then never revisited, meaning steady-state waste compounds every hour, every day, indefinitely. Teams under-invest in it because it requires ongoing measurement and periodic action, competing for attention against feature work that has more visible payoff, and because a resource that's "working fine" doesn't generate the same urgency as one that's broken, even if it's costing several times what it needs to.

What is the difference between a reserved/committed-use discount and a spot/preemptible instance, and when does each make sense?

A committed-use discount (reserved instances, savings plans) trades a usage commitment, a fixed amount of spend or capacity over a term, typically one or three years, for a significant price reduction on workloads you know will run continuously. Spot/preemptible instances offer a much steeper discount in exchange for the provider being able to reclaim the capacity with little notice, making them suitable only for interruption-tolerant workloads (batch jobs, stateless workers, CI runners) rather than anything requiring guaranteed uptime. Committed-use addresses predictable steady-state load; spot addresses flexible, interruption-tolerant load, using either for the wrong workload type either wastes the discount or causes outages.

Why doesn't autoscaling alone guarantee cost efficiency?

Autoscaling matches capacity to load, but only within whatever floor and configuration a team sets, a minimum instance count set too high, overly conservative scale-down thresholds, or scaling policies that react slowly to load drops all leave a workload over-provisioned even with autoscaling technically "on." Autoscaling is necessary but not sufficient: it needs to be tuned against real traffic patterns and revisited periodically, the same way static rightsizing does, or it just becomes a more complex way to still be over-provisioned most of the time.

References

ShareXLinkedInReddit
Was this page helpful?
Suggest an improvement