SynfraCore
Synfracore
Start Learning
Navigation

Academies

Platform

RoadmapsLabsCertificationsInterviewPYQsAI AssistantCareer
Start Learning Free🗺️ Learning Roadmaps

Cost OptimizationCheatsheets

Quick reference — commands, syntax, and patterns

✍️
Written by senior engineers. Reviewed for technical accuracy.· Updated 2025 · SynfraCore Cost Optimization Team
Expert Content

Cloud Cost Optimization Cheatsheet

AWS Cost Commands

bash
# Current month spend by service
aws ce get-cost-and-usage \
  --time-period Start=2025-06-01,End=2025-06-30 \
  --granularity MONTHLY \
  --metrics BlendedCost \
  --group-by Type=DIMENSION,Key=SERVICE

# Cost by tag
aws ce get-cost-and-usage \
  --time-period Start=2025-06-01,End=2025-06-30 \
  --granularity DAILY --metrics BlendedCost \
  --group-by Type=TAG,Key=Environment

# Rightsizing recommendations
aws ce get-rightsizing-recommendation --service EC2

# Reserved Instance utilisation
aws ce get-reservation-utilization \
  --time-period Start=2025-05-01,End=2025-06-01

# Savings Plans recommendations
aws ce get-savings-plans-purchase-recommendation \
  --savings-plans-type COMPUTE_SP \
  --term-in-years ONE_YEAR --payment-option NO_UPFRONT

# Identify unused EBS volumes
aws ec2 describe-volumes \
  --filters Name=status,Values=available \
  --query 'Volumes[].{ID:VolumeId,Size:Size,State:State}'

# List unattached Elastic IPs
aws ec2 describe-addresses \
  --query 'Addresses[?!InstanceId].PublicIp'

Azure Cost Commands

bash
# Cost by resource group
az consumption usage list \
  --start-date 2025-06-01 --end-date 2025-06-30 \
  --query "[].{ResourceGroup:resourceGroup,Cost:pretaxCost,Currency:currency}" \
  --output table

# Advisor cost recommendations
az advisor recommendation list --category Cost

# Identify unattached disks
az disk list --query "[?diskState=='Unattached'].{Name:name,Size:diskSizeGb,RG:resourceGroup}"

# Identify unused public IPs
az network public-ip list --query "[?ipAddress==null].{Name:name,RG:resourceGroup}"

Key Optimization Strategies

StrategySavingsEffort

|----------|---------|--------|

Delete unused resources (idle EC2, unattached disks)10-30%Low
Rightsize oversized instances15-40%Medium
Reserved Instances / Savings Plans / Committed Use30-72%Low (1-3yr commit)
Spot/Preemptible/Spot VMs for fault-tolerant workloads60-90%High
Auto-scaling (scale in during low demand)20-50%Medium
S3/Blob lifecycle policies (move to cold storage)50-70% on cold dataLow
Scheduled start/stop (dev/test environments)60-70% on non-prodLow
Data transfer optimization (same-region, CloudFront)VariableMedium
Graviton/Arm instances (AWS) — 20% better price/perf20%Low

Quick Wins Checklist

☐ Enable Cost Explorer / Azure Cost Management / GCP Billing
☐ Set up billing alerts (alert at 80% and 100% of budget)
☐ Delete unattached EBS volumes and Azure Disks
☐ Release unattached Elastic IPs / Azure Public IPs
☐ Terminate stopped instances older than 30 days (verify first)
☐ Enable S3 Intelligent-Tiering or lifecycle rules
☐ Right-size instances flagged by Cost Explorer / Advisor
☐ Purchase RIs/Savings Plans for baseline steady-state workloads
☐ Tag all resources (enables cost allocation by team/project)
☐ Stop dev/test instances on weekends (70% savings on non-prod)
Share:
Join our Community
Daily tips, job alerts, interview help — join engineers learning together
Up Next
📝
Cost OptimizationNotes
Key takeaways, tips, and important points to remember
Also Worth Exploring
← Back to all Cost Optimization modules
CertificationNotes