Cloud Cost Optimization: FinOps Best Practices ile %40 Tasarruf
Cloud Cost Optimization: FinOps Best Practices ile %40 Tasarruf
Cloud bill every month artıyor. "We migrated to cloud to save money" demiştiniz. Şimdi on-premise'den pahalı. FinOps ile cost control geri kazanın.
FinOps Nedir?
Financial Operations - Cloud financial management. Engineering, Finance, Business collaboration. "Unit economics" odaklı.
Common Cost Culprits
1. Idle Resources
Dev environment 7/24 açık. Gece, weekend kullanılmıyor. %65 waste.
Solution:
# Lambda function - Auto stop dev instances
import boto3
ec2 = boto3.client('ec2')
def lambda_handler(event, context):
# Stop dev instances at 6 PM
instances = ec2.describe_instances(
Filters=[{'Name': 'tag:Environment', 'Values': ['dev']}]
)
instance_ids = [i['InstanceId'] for r in instances['Reservations']
for i in r['Instances']]
if instance_ids:
ec2.stop_instances(InstanceIds=instance_ids)
return {'statusCode': 200}
Savings: $5,000/month → $1,500/month (%70 azalma)
2. Oversized Instances
t3.2xlarge instance, avg CPU %15. Right-size to t3.large → %50 cheaper.
Tools: AWS Compute Optimizer, Azure Advisor
3. Unattached EBS Volumes
Instance sildin, volume kaldı. $0.10/GB/month. 10TB = $1,000/month waste.
# Find unattached volumes
aws ec2 describe-volumes \
--filters Name=status,Values=available \
--query 'Volumes[].{ID:VolumeId,Size:Size,Type:VolumeType}'
4. Data Transfer (Egress) Fees
AWS data transfer out: $0.09/GB. 100TB/month = $9,000!
Solutions:
- CloudFront CDN kullan (cheaper egress)
- Same-region architecture (inter-AZ free)
- S3 Transfer Acceleration avoid (pahalı)
Reserved Instances & Savings Plans
On-Demand vs Reserved:
- t3.medium on-demand: $0.0416/hour = $30/month
- t3.medium reserved (1 year): $0.0270/hour = $19.50/month
- Savings: %35
Strategy:
- Baseline workload → Reserved instances
- Variable workload → Spot instances (%90 discount!)
- Burst → On-demand
Spot Instances
AWS Spot = unused capacity, %70-90 discount. Stateless workloads için perfect.
# Kubernetes cluster autoscaler with spot
apiVersion: v1
kind: ConfigMap
metadata:
name: cluster-autoscaler-priority-expander
data:
priorities: |-
10:
- .*-spot-.*
1:
- .*-ondemand-.*
Spot önce scale, fallback on-demand.
FinOps Metrics
1. Unit Economics
Cost per user, cost per transaction, cost per request.
Example: $50,000 cloud bill / 1M users = $0.05 per user
2. Cloud Efficiency Score
(Utilized resources / Provisioned resources) * 100
Target: >75%
3. Waste Percentage
Idle resources, unattached volumes, old snapshots.
Target: <10%
Tools
- AWS Cost Explorer: Built-in cost analysis
- CloudHealth: Multi-cloud cost management
- Kubecost: Kubernetes cost visibility
- Infracost: Terraform cost estimation
- Vantage: Cost reporting & alerts
Tagging Strategy
Resource tagging ile cost attribution:
tags = {
Environment = "production"
Team = "backend"
Project = "api-v2"
Owner = "[email protected]"
CostCenter = "engineering"
}
Team bazında cost visibility. Showback/Chargeback.
Budget Alerts
# AWS Budget
aws budgets create-budget \
--account-id 123456789 \
--budget file://budget.json \
--notifications-with-subscribers file://notifications.json
# budget.json
{
"BudgetName": "Monthly-Engineering-Budget",
"BudgetLimit": {
"Amount": "10000",
"Unit": "USD"
},
"TimeUnit": "MONTHLY"
}
Optimization Checklist
✅ Idle resources kapatıldı
✅ Right-sizing yapıldı
✅ Reserved instances/Savings Plans
✅ Spot instances (uygun workloads)
✅ Old snapshots/backups temizlendi
✅ Data transfer optimize edildi
✅ Resource tagging %100
✅ Budget alerts configured
✅ Monthly cost review meetings
✅ FinOps culture adoption
Sonuç
FinOps continuous process. Monthly review, optimize, repeat. Average %30-40 savings achievable. Devups FinOps assessment.