Cloud Cost Optimization

Compute Pricing Models

ModelDiscount vs On-DemandBest ForRisk
On-Demand0%Unpredictable workloadsNone
Reserved (1yr, No Upfront)~30-35%Stable baseline load1yr commitment
Reserved (1yr, All Upfront)~40%Stable baseline with cash available1yr commitment + capital
Reserved (3yr, All Upfront)~60-65%Long-term stable workloads3yr lock-in
Savings Plans (AWS)~40-66%Flexible (any instance type/region)Hourly spend commitment
Spot / Preemptible~70-90%Fault-tolerant, batch, CI/CDCan be reclaimed with 2min notice

Storage Cost Tiers (S3/GCS)

TierUse CaseRetrievalCost (relative)
StandardFrequently accessed dataImmediateHighest
Infrequent Access (IA)Monthly access or lessImmediate (retrieval fee)~45% less storage
One Zone IAReproducible, infrequentImmediate (retrieval fee)~55% less storage
Glacier InstantArchives accessed 1-2x/yearMilliseconds~68% less storage
Glacier FlexibleRarely accessed archivesMinutes to hours~83% less storage
Glacier Deep ArchiveLong-term legal/compliance12-48 hours~95% less storage

Hidden Cost Traps

Cost TypeDescriptionMitigation
Data Egress~$0.09/GB for data leaving cloud to internetKeep processing in same region; use CDN; evaluate Cloudflare
Cross-AZ Traffic~$0.01/GB between availability zonesUse same-AZ deployments for high-traffic internal services
NAT Gateway$0.045/GB + hourly; private subnets costUse VPC endpoints for S3/DynamoDB; consider public subnets for batch
Idle resourcesUnused EC2, RDS, load balancersSchedule auto-shutdown for dev/test; delete unused snapshots
Oversized instancesAvg CPU utilization often < 10%Right-size using CloudWatch metrics; use Compute Optimizer
Log storageCloudWatch Logs expensive at scaleSet log retention; send to S3; use Loki as alternative

FinOps Practices

# AWS Cost tagging strategy # Enforce required tags with AWS Config or SCPs Tags: Environment: prod|staging|dev Team: platform|payments|data CostCenter: eng-platform-001 Project: my-project # AWS Cost Explorer queries (CLI) aws ce get-cost-and-usage \ --time-period Start=2024-01-01,End=2024-02-01 \ --granularity MONTHLY \ --metrics BlendedCost \ --group-by Type=DIMENSION,Key=SERVICE # Set budget alerts aws budgets create-budget \ --account-id 123456789 \ --budget file://budget.json \ --notifications-with-subscribers file://notifications.json # Tools for cost visibility: # - AWS Cost Explorer + Cost Anomaly Detection # - Infracost (Terraform cost estimates in PR) # - Kubecost (K8s cost breakdown per namespace/team) # - CloudHealth / Apptio Cloudability (enterprise)